【问题标题】:Installing es6-promise with typings使用类型安装 es6-promise
【发布时间】:2017-02-22 04:29:21
【问题描述】:

我正在阅读这篇关于 Angular 2 的文章 - https://semaphoreci.com/community/tutorials/setting-up-angular-2-with-webpack * 以上文章适用于 Angular 2 RC5。

在我们执行这一行之前,一切都很顺利 - 使用 typescript (typings) 安装 es6-promise。: ./node_modules/.bin/typings 安装 es6-promise --save

在终端中执行此行会引发以下错误:

typings WARN hastypings “es6-promise”的类型已经存在于“node_modules/es6-promise/es6-promise.d.ts”中。您应该让 TypeScript 解析打包的类型并卸载由 Typings 安装的副本 打字错误!消息无法在注册表中找到“es6-promise”(“npm”)。 打字错误!消息 但是,我们发现“es6-promise”有 2 个其他来源:“common”和“dt”

【问题讨论】:

    标签: angularjs typescript es6-promise


    【解决方案1】:

    typings 存储库为 deprecated,您现在可以使用以下命令:

    npm install @types/es6-shim --save

    【讨论】:

      【解决方案2】:

      我也遇到了同样的问题 命令已更改为:

      typings install dt~es6-shim --save --global
      

      您可以查看此 github 问题以供参考: Unable to install es6 Shim or registry:env/meteor

      【讨论】:

      • 现在必须是全球性的吗?还是只是您的偏好?
      • @KonradViltersten,不,它不需要是全局的,只是我在那个实例中的偏好
      • 太棒了!这在 Windows 上帮助了我,我的 package.json 中有一个“typings”脚本:“typings”:“./node_modules/.bin/typings”,我运行了命令:> npm run-script typings -- install dt~es6-shim --save --global
      • 抱歉回复晚了。非常感谢。
      【解决方案3】:

      这对你有用:

      ./node_modules/.bin/typings install es6-promise --source dt --save

      它会为你导入从DefiniteTyped请求的文件。

      【讨论】:

        【解决方案4】:

        看起来您已经随模块安装了类型,因此无需手动执行。尝试跳过这一步 - ./node_modules/.bin/typings install es6-promise --save

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2016-07-15
          • 2016-03-15
          • 2016-05-22
          • 2018-07-09
          • 2019-07-20
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多