我安装了最新的node.js 8.x和npm 5.6.0。尝试执行npm install
时,我不断收到以下错误:
npm ERR!代码E404
npm ERR!找不到404:@ angular / router @ 5.2.0
每次重试安装时失败的模块都不同,但最常见的是@angular/forms@5.2.0
,@angular/animations@5.2.0
和@angular/platform-browser@5.2.0
npm config set registry https://registry.npmjs.org/
。node_modules
文件夹npm cache clean --force
npm search
找到了模块:C:\ windows \ system32> npm search @ angular / router
NAME |描述|作者|日期|版本|关键词
@ angular / router |角度 - ...... | =角| 2018-04-16 | 5.2.10 |角度路由器
还有什么可能是错的?
以下是package.json的完整性:
{
"name": "App",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --env=scapp",
"build-local": "ng build --env=dev",
"build-nonevis": "ng build --env=nonevis",
"test": "ng test",
"lint": "ng lint",
"lint-fix": "ng lint --fix",
"e2e": "ng e2e"
},
"dependencies": {
"@angular/animations": "5.2.0",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/forms": "5.2.0",
"@angular/http": "5.2.0",
"@angular/platform-browser": "5.2.0",
"@angular/platform-browser-dynamic": "5.2.0",
"@angular/router": "5.2.0",
"@ngx-translate/core": "9.1.1",
"@ngx-translate/http-loader": "2.0.1",
"@types/arcgis-js-api": "^4.4.0",
"@types/node": "9.4.0",
"angular2-esri-loader": "^1.0.0",
"cerialize": "^0.1.18",
"chart.js": "2.7.1",
"core-js": "^2.5.1",
"esri-loader": "^1.1.0",
"fullcalendar": "3.7.0",
"intl": "^1.2.5",
"jquery": "3.2.1",
"moment": "2.18.1",
"nanoscroller": "0.8.7",
"ngx-perfect-scrollbar": "5.3.4",
"primeng": "5.2.0",
"quill": "1.1.8",
"rxjs": "5.5.2",
"web-animations-js": "2.3.1",
"zone.js": "0.8.18"
},
"devDependencies": {
"@angular/cli": "^1.6.5",
"@angular/compiler-cli": "^5.2.0",
"@types/jasmine": "2.5.53",
"@types/jasminewd2": "2.0.2",
"@types/node": "6.0.60",
"codelyzer": "4.0.1",
"jasmine-core": "2.6.4",
"jasmine-spec-reporter": "4.1.1",
"karma": "1.7.1",
"karma-chrome-launcher": "2.1.1",
"karma-cli": "1.0.1",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"karma-coverage-istanbul-reporter": "1.3.0",
"protractor": "5.1.2",
"ts-node": "3.2.0",
"tslint": "5.7.0",
"typescript": "2.4.2"
}
}
答案 0 :(得分:0)
问题是由包含行.npmrc
的本地文件always-auth = true
引起的。删除此行可解决此问题。我不知道404错误是如何与身份验证相关的,但是注意到在我切换到镜像注册表之后,它突然报告了E401而不是官方注册表中的E404。
答案 1 :(得分:0)
就我而言,通过在命令中添加@latest可以解决此问题。
npm install -g @ angular / cli @ latest