环境标志已弃用 [英] Ambient flag is deprecated
问题描述
我正在尝试在我的应用程序中安装依赖项我得到错误的环境标志已经折旧,并且终端说要用--global替换它我完成了它但现在终端说无法找到节点(npm )在注册表中。我按照此链接进行e2e测试 http://lathonez.github.io/ 2016 / ionic-2-e2e-testing /
I am trying to install dependency in my app i get err that ambient flag is depreciated and also terminal says to replace it with --global i done it but now terminal says that "Unable to find "node" ("npm") in the registry". I followed this link to make e2e testing http://lathonez.github.io/2016/ionic-2-e2e-testing/
yokeshs-Mac-mini:easycloud yokesh$ sudo typings install express --save --ambient
typings ERR! deprecated The "ambient" flag is deprecated. Please use "global" instead
yokeshs-Mac-mini:easycloud yokesh$ sudo typings install --global --save angular-protractor jasmine node selenium-webdriver
typings ERR! message Unable to find "node" ("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 ERR! caused by https://api.typings.org/entries/npm/node/versions/latest responded with 404, expected it to equal 200
typings ERR! cwd /Users/yokesh/easycloud
typings ERR! system Darwin 15.5.0
typings ERR! command "/usr/local/bin/node" "/usr/local/bin/typings" "install" "--global" "--save" "angular-protractor" "jasmine" "node" "selenium-webdriver"
typings ERR! node -v v4.4.3
typings ERR! typings -v 1.1.0
typings ERR! If you need help, you may report this error at:
typings ERR! <https://github.com/typings/typings/issues>
yokeshs-Mac-mini:easycloud yokesh$
我只是想知道如何安装此命令typings install --ambient --save angular-protractor jasmine node selenium-webdriver
I just wanted to know how to install this command "typings install --ambient --save angular-protractor jasmine node selenium-webdriver"
推荐答案
从版本1.0 TypeScript开始定义管理器进行了一些更新(请参阅此处),其中包括弃用 - ambient
flag。
As of version 1.0 TypeScript Definition Manager made some updates (see here) which included deprecating the --ambient
flag.
- 环境用法现在全球
- 这意味着在
typings.json
任何ambientDependencies
应重命名为globalDependencies
,任何ambientDevDependencies
应为
重命名为globalDevDependencies
。
- 这也意味着
- 环境
现在- 全球
- Usages of ambient are now global
- That means in
typings.json
anyambientDependencies
should be renamedglobalDependencies
and anyambientDevDependencies
should be renamedglobalDevDependencies
.- It also means
--ambient
is now--global
参考在GitHub页面上快速入门示例,您需要做的是明确引用注册表所在的位置您正在安装类型定义,以便Typings知道在哪里查找它。
Referencing the Quick Start example on the GitHub page, what you need to do is explicitly reference the registry where you are installing the type definition(s) from so that Typings will know where to look for it.
示例(Windows CLI)
通过搜索找到包
typings search * name *
然后从命令行中的打印结果表中获取源(源列)
Then get the source from the printed result table in the command line (source column)
| NAME | SOURCE | HOMEPAGE | DESCRIPTION | VERSIONS | UPDATED |
|--------------------------------------------------------------
| | | | | | |
| | | | | | |
在此示例中,您要安装的每个包都返回源 dt
。在我的安装命令中,我现在必须明确告诉typings从 dt
安装每个包( DefinitelyTyped )。
In this example each package you want installing returns with the source dt
. In my install command I now have to tell typings explicitly to install each package from dt
(DefinitelyTyped).
typings install --global --save dt~angle-protractor dt~jasmine dt~ node dt~selenium-webdriver
这篇关于环境标志已弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!