【问题标题】:Cannot update to Angular2 RC @angular@2.0.0-rc.1无法更新到 Angular2 RC @angular@2.0.0-rc.1
【发布时间】:2016-05-30 15:46:16
【问题描述】:

当我尝试将 angular2 升级到 RC 时出现以下错误。 JWT 依赖于 RC,所以我不得不更新到 @angular

M:\workspace\Angular2StartKit>npm install
npm ERR! addLocal Could not install M:\workspace\Angular2StartKit\@angular@2.0.0-rc.1
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\manish\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.2.2
npm ERR! npm  v3.9.5
npm ERR! path M:\workspace\Angular2StartKit\@angular@2.0.0-rc.1
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open 'M:\workspace\Angular2StartKit\@angular@2.0.0-rc.1'
npm ERR! enoent ENOENT: no such file or directory, open 'M:\workspace\Angular2StartKit\@angular@2.0.0-rc.1'
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! M:\workspace\Angular2StartKit\npm-debug.log    

package.json

"dependencies": {  
    "angular2": "2.0.0-beta.1",  
    "angular2-jwt": "^0.1.12",  
    "body-parser": "~1.13.2",  
    "cors": "^2.7.1",  
    "es6-promise": "3.0.2",  
    "es6-shim": "0.33.3",  
    "express": "4.13.3",  
    "express-jwt": "^3.4.0",  
    "gulp-concat": "2.6.0",  
    "material-design-lite": "^1.1.3",  
    "mongodb": "^2.1.16",  
    "mongoose": "^4.4.12",  
    "promise": "^7.1.1",  
    "reflect-metadata": "0.1.2",  
    "rxjs": "5.0.0-beta.0",  
    "systemjs": "0.19.16",  
    "zone.js": "0.5.10"  
    }`      

【问题讨论】:

  • 只需查看第 12 行错误:没有这样的文件或目录.. 可能会比较来自 angular.io/docs/ts/latest/quickstart.html 的 pacages 或者可能是 M:\workspace\Angular2StartKit路径问题
  • 来自 rc1 的文档:通过在终端/控制台窗口中运行 node -v 和 npm -v 来验证您是否正在运行 node v5.x.x 和 npm 3.x.x。旧版本和新版本都会产生错误。

标签: npm angular


【解决方案1】:

在 Angular2 RC1 中,您需要在 package.json 文件中指定一组子包,而不是像 Beta 版本那样的大包:

{
  (...)
  "dependencies": {
    "@angular/common": "2.0.0-rc.1",
    "@angular/compiler": "2.0.0-rc.1",
    "@angular/core": "2.0.0-rc.1",
    "@angular/http": "2.0.0-rc.1",
    "@angular/platform-browser": "2.0.0-rc.1",
    "@angular/platform-browser-dynamic": "2.0.0-rc.1",
    "@angular/router": "2.0.0-rc.1",
    "@angular/router-deprecated": "2.0.0-rc.1",
    "@angular/upgrade": "2.0.0-rc.1",
    (...)
  }
}

【讨论】:

  • 这意味着我必须更改文件中的所有导入...叹息
  • 你在 package.json 文件中使用 Angular2 beta1 吗?
  • 是的..这是正确的。由于 RC 引起问题,我将其改回 beta。我会尝试你的建议,分别包含所有的包。
  • 回到 beta.17 可能是比 beta.1 更好的选择。 Beta 版本发生了许多变化,这意味着如果您完全回到 1,更新到未来的 rc 版本将更加困难。
  • 同意! beta17 应该比 beta1 更接近 rc。包重命名是在 beta 和 rc 之间完成的......所以你肯定会产生影响。
猜你喜欢
  • 2016-09-15
  • 1970-01-01
  • 2016-09-02
  • 2016-09-02
  • 2016-10-18
  • 2016-12-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多