【问题标题】:Angular 2 upgrade to rc 5 - unmet peer dependenciesAngular 2 升级到 rc 5 - 未满足的对等依赖项
【发布时间】:2016-12-17 14:41:51
【问题描述】:

我需要将 Angular 升级到 rc5 才能使用 NgModule。

我已关注directions from Angular 2

我已经更新了我的 package.json 依赖项,然后在终端中运行 npm stall:

  "dependencies": {
    "@angular/common": "^2.0.0-rc.5",
    "@angular/compiler": "^2.0.0-rc.5",
    "@angular/core": "^2.0.0-rc.5",
    "@angular/forms": "0.3.0",
    "@angular/http": "2.0.0-rc.5",
    "@angular/platform-browser": "^2.0.0-rc.5",
    "@angular/platform-browser-dynamic": "^2.0.0-rc.5",
    "@angular/router": "3.0.0-beta.1",
    "@angular/router-deprecated": "2.0.0-rc.2",
    "@angular/upgrade": "2.0.0-rc.5",
    "angular2-google-maps": "^0.12.0",
    "angular2-in-memory-web-api": "0.0.14",
    "bootstrap": "^3.3.6",
    "core-js": "^2.4.0",
    "jquery": "v3.1.0",
    "ng2-select": "^1.0.3",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-beta.6",
    "systemjs": "0.19.27",
    "zone.js": "^0.6.12"
  },

最终结果:

Benjamins-MacBook-Pro:the-vegan-repository Ben$ npm install

> the-vegan-repository@1.0.0 postinstall /Users/Ben/Development/the-vegan-repository
> typings install

typings WARN deprecated 7/26/2016: "registry:dt/core-js#0.0.0+20160602141332" is deprecated (updated, replaced or removed)
typings WARN deprecated 8/7/2016: "registry:dt/node#6.0.0+20160621231320" is deprecated (updated, replaced or removed)

├── core-js (global)
├── jasmine (global)
└── node (global)

npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/common@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/compiler@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/core@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser-dynamic@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of es6-shim@^0.35.0 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/core@2.0.0-rc.4 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/http@2.0.0-rc.4 but none was installed.
npm WARN EPACKAGEJSON the-vegan-repository@1.0.0 No repository field.

我已经尝试过 Angular 2 建议的其他选项:

npm install @angular/{core,common,compiler,platform-browser,platform-browser-dynamic} --save

结果:

Benjamins-MacBook-Pro:the-vegan-repository Ben$ npm install @angular/{core,common,compiler,platform-browser,platform-browser-dynamic} --save
the-vegan-repository@1.0.0 /Users/Ben/Development/the-vegan-repository
├── UNMET PEER DEPENDENCY @angular/common@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/compiler@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/core@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/http@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/platform-browser@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/platform-browser-dynamic@2.0.0-rc.5
└── UNMET PEER DEPENDENCY es6-shim@^0.35.0

npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/common@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/compiler@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/core@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser-dynamic@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of es6-shim@^0.35.0 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/core@2.0.0-rc.4 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/http@2.0.0-rc.4 but none was installed.
npm WARN EPACKAGEJSON the-vegan-repository@1.0.0 No repository field.
npm ERR! code 1

无论我做什么升级,我都会遇到同样的未满足的对等依赖项错误。

解决我尝试过的问题:

npm install @angular

结果:

Benjamins-MacBook-Pro:the-vegan-repository Ben$ npm install @angular
npm ERR! addLocal Could not install /Users/Ben/Development/the-vegan-repository/@angular
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "@angular"
npm ERR! node v5.3.0
npm ERR! npm  v3.3.12
npm ERR! path /Users/Ben/Development/the-vegan-repository/@angular
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/Users/Ben/Development/the-vegan-repository/@angular'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Ben/Development/the-vegan-repository/npm-debug.log

npm install @angular/common

结果:

Benjamins-MacBook-Pro:the-vegan-repository Ben$ npm install @angular/common
the-vegan-repository@1.0.0 /Users/Ben/Development/the-vegan-repository
├── UNMET PEER DEPENDENCY @angular/common@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/compiler@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/core@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/http@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/platform-browser@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/platform-browser-dynamic@2.0.0-rc.5
└── UNMET PEER DEPENDENCY es6-shim@^0.35.0

npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/common@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/compiler@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/core@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser-dynamic@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of es6-shim@^0.35.0 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/core@2.0.0-rc.4 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/http@2.0.0-rc.4 but none was installed.
npm WARN EPACKAGEJSON the-vegan-repository@1.0.0 No repository field.
npm ERR! code 1

npm install @angular/common@2.0.0-rc.5

结果:

Benjamins-MacBook-Pro:the-vegan-repository Ben$ npm install @angular/common@2.0.0-rc.5
the-vegan-repository@1.0.0 /Users/Ben/Development/the-vegan-repository
├── UNMET PEER DEPENDENCY @angular/common@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/compiler@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/core@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/http@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/platform-browser@2.0.0-rc.5
├── UNMET PEER DEPENDENCY @angular/platform-browser-dynamic@2.0.0-rc.5
└── UNMET PEER DEPENDENCY es6-shim@^0.35.0

npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/common@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/compiler@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/core@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/platform-browser-dynamic@2.0.0-rc.2 but none was installed.
npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of es6-shim@^0.35.0 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/core@2.0.0-rc.4 but none was installed.
npm WARN EPEERINVALID angular2-in-memory-web-api@0.0.14 requires a peer of @angular/http@2.0.0-rc.4 but none was installed.
npm WARN EPACKAGEJSON the-vegan-repository@1.0.0 No repository field.
npm ERR! code 1

请注意,这是一个工作的 angular 2 应用程序,所以我似乎确实安装了 angular 2。如何满足我的对等依赖项以便我可以升级到 angular2 rc5?

【问题讨论】:

    标签: angular npm npm-install package.json


    【解决方案1】:

    你试过新鲜的npm install吗?绝对会推荐。还要尝试事先清理缓存以确保您没有先前的冲突:

    rm -rf node_modules/
    npm cache clean
    npm install
    

    我还建议您将路由器更新为3.0.0-rc.1。这是最新版本。

    编辑:我还建议您删除您的 node_modules 目录并安装一个新目录:rm -rf node_modules

    【讨论】:

    • 也许我会在之前清空 package.json 中的旧依赖项并使用 --save 标志,..
    • 让我在 mac 上遇到了恢复 node_modules 的问题 :(,不要删除根 node_modules,做错了
    【解决方案2】:

    您收到此错误的原因是因为您将"angular2-google-maps": "^0.12.0" 与 angular2 一起使用。现在"angular2-google-maps" 是对等依赖于angular 2.0.0-rc.2 版本,这就是错误状态:

    npm WARN EPEERINVALID angular2-google-maps@0.12.0 requires a peer of @angular/common@2.0.0-rc.2 but none was installed.

    这仍然是一个悬而未决的问题,如 here 所示。

    • 我建议你要么使用angular 2.0.0-rc.2,直到它得到 解决。
    • 第二种方法是使用npm i https://github.com/SebastianM/angular2-google-maps/tarball/0.12.0 --save 安装google-maps。

    希望对你有帮助!

    编辑:他们将在几天内发布0.13.0 版本,该版本将与rc5 兼容。更多信息请看here

    【讨论】:

      【解决方案3】:

      如果还是有问题可以试试

      npm --depth Infinity update
      

      【讨论】:

        【解决方案4】:

        这是我也面临的同样问题-

        我只是更新 npm-

        sudo npm install npm -g
        

        我的问题解决了!!!

        【讨论】:

          猜你喜欢
          • 2017-05-21
          • 2017-11-06
          • 2023-03-23
          • 1970-01-01
          • 2018-07-12
          • 2016-08-29
          • 1970-01-01
          • 1970-01-01
          • 2018-01-21
          相关资源
          最近更新 更多