【问题标题】:Ambient flag is deprecated环境标志已弃用
【发布时间】:2016-10-14 23:38:59
【问题描述】:

我正在尝试在我的应用程序中安装依赖项,但我得到错误提示环境标志已折旧,并且终端说用 --global 替换它我做到了,但现在终端说“无法找到“节点”(“npm” ) 在注册表中"。我按照这个链接进行e2e测试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”

【问题讨论】:

  • 输入typings search express,你会看到它的版本是dt,意思是DefiniteTyped。尝试执行以下命令,告诉它从DefinitelyTyped typings install dt~express --global 获取类型
  • 谢谢。这对我有用github.com/lathonez/clicker/issues/101
  • @Will.Harris 请添加您的评论作为答案,以便 Yokesh 可以接受。谢谢!
  • 不确定 Yokesh 是否从我的评论或他提供的链接中得到了答案。我会回答我的评论,如果其他解决方案对他有用,Yokesh 可以更新它

标签: angularjs node.js selenium ionic2 e2e-testing


【解决方案1】:

从 1.0 版开始,TypeScript 定义管理器进行了一些更新 (see here),其中包括弃用了 --ambient 标志。

  • ambient 的使用现在是全球性的
    • 这意味着在typings.json 中任何ambientDependencies 都应该重命名为globalDependencies 并且任何ambientDevDependencies 应该是 重命名globalDevDependencies
    • 这也意味着--ambient 现在是--global

引用 GitHub 页面上的 Quick Start example,您需要做的是明确引用您要安装类型定义的注册表,以便 Typings 知道在哪里查找它。

示例(Windows CLI)

通过搜索找到包裹

typings search *name*

然后在命令行中从打印的结果表中获取源(源列)

| NAME | SOURCE | HOMEPAGE | DESCRIPTION | VERSIONS | UPDATED |
|--------------------------------------------------------------
|      |        |          |             |          |         |
|      |        |          |             |          |         |

在此示例中,您要安装的每个软件包都返回源 dt。在我的安装命令中,我现在必须明确告诉打字员从dt (DefinitelyTyped) 安装每个包。

typings install --global --save dt~angular-protractor dt~jasmine dt~node dt~selenium-webdriver

【讨论】:

    猜你喜欢
    • 2020-12-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-05-02
    • 2014-02-12
    • 2020-02-02
    • 2018-08-13
    • 2014-10-14
    相关资源
    最近更新 更多