npm ERR!无效的名称:遵循Angular 2快速入门后的“@ angular / core”

前端之家收集整理的这篇文章主要介绍了npm ERR!无效的名称:遵循Angular 2快速入门后的“@ angular / core”前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我试图跟随 Angular 2 Quick Start,其中的第一步是设置环境.我不是全新的npm – 我设法安装并尝试了Ember,但这是关于它.

以下是我创建的package.json文件(从上面的链接复制).
当我运行npm安装这里是我得到的.
快速开始说我不会看到任何npm ERR!线.

npm WARN optional Skipping Failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.12
npm WARN angular2-quickstart@1.0.0 No description
npm WARN angular2-quickstart@1.0.0 No repository field.
npm ERR! Linux 3.13.0-85-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v5.10.1
npm ERR! npm  v3.8.3

npm ERR! Invalid name: "@angular/core"
npm ERR! 
npm ERR! If you need help,you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/john/development/angular/angular2-quickstart/npm-debug.log

额外的尝试只是给我更多的一样:

$npm install
npm ERR! Linux 3.13.0-85-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v5.10.1
npm ERR! npm  v3.8.3

npm ERR! Invalid name: "@angular/router-deprecated"
npm ERR! 
npm ERR! If you need help,you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /home/john/development/angular/angular2-quickstart/npm-debug.log

这是npm-debug.log的完整追溯,如果这有助于任何人:

60 verbose stack Error: Invalid name: "@angular/core"
60 verbose stack     at ensureValidName (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:302:15)
60 verbose stack     at Object.module.exports.fixNameField (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/fixer.js:206:5)
60 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:29:38
60 verbose stack     at Array.forEach (native)
60 verbose stack     at normalize (/usr/local/lib/node_modules/npm/node_modules/read-package-json/node_modules/normalize-package-data/lib/normalize.js:28:15)
60 verbose stack     at final (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:338:5)
60 verbose stack     at then (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:113:5)
60 verbose stack     at ReadFileContext.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/read-package-json/read-json.js:284:20)
60 verbose stack     at ReadFileContext.callback (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16)
60 verbose stack     at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:324:13)
61 verbose cwd /home/john/development/angular/angular2-quickstart
62 error Linux 3.13.0-85-generic
63 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "@angular/core"
64 error node v5.10.1
65 error npm  v3.8.3
66 error Invalid name: "@angular/core"
67 error If you need help,you may report this error at:
67 error     <https://github.com/npm/npm/issues>
68 verbose exit [ 1,true ]

的package.json:

{
  "name": "angular2-quickstart","version": "1.0.0","scripts": {
    "start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ","lite": "lite-server","postinstall": "typings install","tsc": "tsc","tsc:w": "tsc -w","typings": "typings"
  },"license": "ISC","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","systemjs": "0.19.27","es6-shim": "^0.35.0","reflect-Metadata": "^0.1.3","rxjs": "5.0.0-beta.6","zone.js": "^0.6.12","angular2-in-memory-web-api": "0.0.7","bootstrap": "^3.3.6"
  },"devDependencies": {
    "concurrently": "^2.0.0","lite-server": "^2.2.0","typescript": "^1.8.10","typings":"^0.8.1"
  }
}
由于我的评论回答了这个问题,我将以未来访问此页面的人的答案形式提供.

经过一番谷歌搜索后,我发现两页有同样的问题; page 1page 2.似乎在一些版本的NPM中有一个错误,所以只需升级到较新版本就可以解决问题:

sudo npm install -g npm

降级也可以解决问题:

sudo npm install -g npm @< version here>

希望这可以帮助

猜你在找的Angularjs相关文章