2

所以我正在研究 Ionice2 项目(这仍然是新的.. 差不多一周),我正在尝试按照下面的教程使用 PouchDB for LocalStorage。

教程: http: //gonehybrid.com/how-to-use-pouchdb-sqlite-for-local-storage-in-ionic-2/

要求之一是使用以下命令安装要求

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
4

2 回答 2

3

打字最近更新了。首先更新到最新版本的打字。

要安装 require.d.ts 文件,请使用 typings install dt~require --save --global

有关详细信息,请参阅https://github.com/typings/typings

于 2016-05-26T06:37:18.557 回答
1

不是对这个问题的直接回答,但我认为应该提及。Typescript 团队最近添加了一种管理定义文件的内置方式。他们@typesnpm. 整个目标是您不需要使用两个单独的包管理器,也不需要使用多个配置文件(以前package.json是 ,typings.json等)。现在,这一切都在package.json.

例如,如果您要安装lodash. 你刚才:

npm install --save lodash
npm install --save @types/lodash

你可以走了。两者都在您的管理中package.json,您不需要使用任何/// <reference-path path="blah-blah-blah">.

或者,正如微软所说,“声明文件的未来”

于 2017-01-11T04:58:44.123 回答