3

I have the latest node.js 8.x and npm 5.6.0 installed. When trying to do a npm install, I constantly get the following error:

npm ERR! code E404

npm ERR! 404 Not Found: @angular/router@5.2.0

The module that fails is different every time I retry the installation, but most typically it's @angular/forms@5.2.0, @angular/animations@5.2.0 and @angular/platform-browser@5.2.0

  • I do have a working internet connection
  • I have run npm config set registry https://registry.npmjs.org/.
  • I deleted the node_modules folder
  • I have deleted the cache: npm cache clean --force
  • An npm search does find the module:

C:\windows\system32>npm search @angular/router

NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS

@angular/router | Angular - the… | =angular | 2018-04-16 | 5.2.10 | angular router

What else can be wrong?

Here is the package.json for completeness:

{
  "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"
  }
}
netik
  • 1,736
  • 4
  • 22
  • 45
  • Possible duplicate of [Can't install any packages in Node.js using "npm install"](https://stackoverflow.com/questions/11920571/cant-install-any-packages-in-node-js-using-npm-install) – cmbuckley Apr 30 '18 at 10:35
  • npm does not seem to be down, so I don't think this is related – netik Apr 30 '18 at 10:46

2 Answers2

1

The problem was caused by a local file .npmrc which contained the line always-auth = true. Removing this line resolved the issue. I have no idea how a 404 error is related to authentication, but noticed that after I switched to a mirror registry, it suddenly reported E401 instead of E404 like the official registry.

netik
  • 1,736
  • 4
  • 22
  • 45
1

In my case, such issue was resolved by adding @latest to the command.

npm install -g @angular/cli@latest

Irina
  • 9
  • 2