Ionic2 应用程序需要安装 Typings
Install Typings require for Ionic2 application
所以我正在研究 Ionice2 项目(这还是个新项目..将近一周),我正在尝试按照下面的教程将 PouchDB 用于 LocalStorage。
教程:
http://gonehybrid.com/how-to-use-pouchdb-sqlite-for-local-storage-in-ionic-2/
要求之一是使用以下命令安装 require
typings install require --ambient --save
每当我尝试这个命令时,我都会收到错误
Unable to find "require" ("npm") in the registry.
Did you want to try searching another source?
Also, if you want contribute these typings, please help us: https://github.com/typings/registry
注意到我已经使用下面的命令安装了 Typings,这个问题的可能原因是什么?
npm install typings --global
打字最近更新了。首先更新到最新版本的打字。
要安装 require.d.ts 文件,请使用 typings install dt~require --save --global
不是问题的直接答案,但我认为应该提及。 Typescript 团队最近添加了一种内置的定义文件管理方式。他们在 npm
之上构建了 @types
系统。整个目标是您不需要使用两个单独的包管理器,也不需要使用多个配置文件(以前的 package.json
、typings.json
等)。现在,这一切都在 package.json
.
内进行管理
例如,如果您要安装 lodash
。你只是:
npm install --save lodash
npm install --save @types/lodash
你可以开始了。两者都在您的 package.json
中进行管理,您不需要使用任何 /// <reference-path path="blah-blah-blah">
.
或者,如 Microsoft 所说,"The Future of Declaration Files"。
所以我正在研究 Ionice2 项目(这还是个新项目..将近一周),我正在尝试按照下面的教程将 PouchDB 用于 LocalStorage。
教程: http://gonehybrid.com/how-to-use-pouchdb-sqlite-for-local-storage-in-ionic-2/
要求之一是使用以下命令安装 require
typings install require --ambient --save
每当我尝试这个命令时,我都会收到错误
Unable to find "require" ("npm") in the registry.
Did you want to try searching another source?
Also, if you want contribute these typings, please help us: https://github.com/typings/registry
注意到我已经使用下面的命令安装了 Typings,这个问题的可能原因是什么?
npm install typings --global
打字最近更新了。首先更新到最新版本的打字。
要安装 require.d.ts 文件,请使用 typings install dt~require --save --global
不是问题的直接答案,但我认为应该提及。 Typescript 团队最近添加了一种内置的定义文件管理方式。他们在 npm
之上构建了 @types
系统。整个目标是您不需要使用两个单独的包管理器,也不需要使用多个配置文件(以前的 package.json
、typings.json
等)。现在,这一切都在 package.json
.
例如,如果您要安装 lodash
。你只是:
npm install --save lodash
npm install --save @types/lodash
你可以开始了。两者都在您的 package.json
中进行管理,您不需要使用任何 /// <reference-path path="blah-blah-blah">
.
或者,如 Microsoft 所说,"The Future of Declaration Files"。