22

I recently cloned the official AngularJS Quickstart code and ran npm install. I received a 404. error 404 'angular' is not in the npm registry. Here is my npm debug log:

    17 silly registry.get     'content-length': '40',
517 silly registry.get     'accept-ranges': 'bytes',
517 silly registry.get     date: 'Tue, 10 May 2016 15:00:17 GMT',
517 silly registry.get     via: '1.1 varnish',
517 silly registry.get     age: '0',
517 silly registry.get     connection: 'keep-alive',
517 silly registry.get     'x-served-by': 'cache-sin6927-SIN',
517 silly registry.get     'x-cache': 'MISS',
517 silly registry.get     'x-cache-hits': '0',
517 silly registry.get     'x-timer': 'S1462892417.310196,VS0,VE210' } ]
518 silly lockFile b50e344d-angular-core-2-0-0-rc-1 angular/core@2.0.0-rc.1
519 silly lockFile b50e344d-angular-core-2-0-0-rc-1 angular/core@2.0.0-rc.1
520 error 404 'angular' is not in the npm registry.
520 error 404 You should bug the author to publish it
520 error 404
520 error 404 Note that you can also install from a
520 error 404 tarball, folder, or http url, or git url.
521 error System Linux 3.19.0-47-generic
522 error command "/usr/bin/nodejs" "/usr/bin/npm" "install"
523 error cwd /home/aayush/try2
524 error node -v v0.10.25
525 error npm -v 1.3.10
526 error code E404
527 verbose exit [ 1, true ]

Here is the package.json file:

{
  "name": "angular2-quickstart",
  "version": "1.0.0",
  "description": "QuickStart package.json from the documentation, supplemented with testing support",
  "scripts": {
    "start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
    "docker-build": "docker build -t ng2-quickstart .",
    "docker": "npm run docker-build && docker run -it --rm -p 3000:3000 -p 3001:3001 ng2-quickstart",
    "e2e": "tsc && concurrently \"http-server\" \"protractor protractor.config.js\"",
    "lint": "tslint ./app/**/*.ts -t verbose",
    "lite": "lite-server",
    "postinstall": "typings install",
    "test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "typings": "typings",
    "webdriver:update": "webdriver-manager update"
  },
  "keywords": [],
  "author": "",
  "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",
    "angular": "~1.5.5"
  },
  "devDependencies": {
    "concurrently": "^2.0.0",
    "lite-server": "^2.2.0",
    "typescript": "^1.8.10",
    "typings": "^0.8.1",
    "canonical-path": "0.0.2",
    "http-server": "^0.9.0",
    "tslint": "^3.7.4",
    "lodash": "^4.11.1",
    "jasmine-core": "~2.4.1",
    "karma": "^0.13.22",
    "karma-chrome-launcher": "^0.2.3",
    "karma-cli": "^0.1.2",
    "karma-htmlfile-reporter": "^0.2.2",
    "karma-jasmine": "^0.3.8",
    "protractor": "^3.3.0",
    "rimraf": "^2.5.2"
  },
  "repository": {}
}

Can someone tell what is wrong...which npm package to use and what code changes will i have to do in the offiial angular heroes tutorial. Thanks

Aayush Aarwal
  • 684
  • 3
  • 9
  • 21

5 Answers5

20

It looks like it doesn't know what registry to point to since the package names look correct.

First try a cache clean.

npm cache clean

And if that doesn't work, specify the registry directly:

npm install <packagename> --registry http://registry.npmjs.org/
David L
  • 32,885
  • 8
  • 62
  • 93
  • 1
    It was the registry for me. I had a custom registry set (as I'm using Sinopia), and Sinopia handled the `@angular` package such that it did not proxy through to the main `npm` registry properly. – elwyn May 11 '16 at 03:20
  • I have the same error, registry is npm's default... Package url: 404 https://registry.npmjs.org/angular/http/2.0.0-rc.1 – SparK May 13 '16 at 17:53
  • @Spark That's because your registry url is incorrect as far as I can tell. It SHOULD be https://registry.npmjs.org/@angular/http/2.0.0-rc.1 – David L May 13 '16 at 19:18
  • I did this. It was definitely progress because formerly I was only getting the Angular 1 package. _Now_ `npm` downloaded a _Beta_. I was looking for the Angular2 Release version. Is there a trick for Linux? I see the log complains if I use a "@angular" in the file name... – will Sep 26 '16 at 21:32
  • @will the beta versions all included beta in the name, as well as not using `@angular` scoped packages. If you use a scoped package such as `@angular/common: 2.0.0`, you should be getting the newly released final version. In addition, if running into issues on Linux, you might either need to use the sudo command or you might be behind a proxy that prevents scoped packages. See https://github.com/rlidwka/sinopia/issues/278 – David L Sep 26 '16 at 21:34
  • The package is visible and `npm` even attempts to download it I was getting an error like "`root cannot create directory '/home/will/node-test/@angular' ...`" or similar (I'm on a different PC today). I made that directory with bash but it failed on the next step. I plan to load components individually when I get back to that project, that may help. – will Sep 27 '16 at 02:07
  • @DavidL ... thanks for the pointers. Not proxies something in the command was off. However although I'm closer, now I get what appears to be a contradictory message about dependencies, see: http://stackoverflow.com/q/39724480/108350 – will Sep 27 '16 at 12:21
  • This worked for me. I was getting the 404 on all the scoped angular packages. I updated Node and NPM to latest versions with no change. Specifying the registry along with NPM install worked perfectly. So apparently something is wrong with my registry, even though I have a clean install of Node. Thanks @DavidL – Daniel Nalbach Nov 08 '16 at 20:32
  • @DanielNalbach glad it helped! – David L Nov 08 '16 at 20:37
11

I had this same issue. Then, I realized I was using npm 1.4.3. Upgraded to 3.9.2. No problems finding the repo, now!

Cameron Hurd
  • 4,836
  • 1
  • 22
  • 31
3

You need to check if your npm and node.js is up-to-date (at least npm 3.x.x and node v5.x.x, as this angular team's link suggested). If not, you need to upgrade them (I have used this post to upgrade). After this, when I run npm install, the 404 error is gone, but I still have the Darwin 15.5.0 error. Then I run:

sudo npm update -g && sudo npm install -g concurrently lite-server typescript

and uninstall the local version: npm uninstall lite-server as proposed by this link. But the Darwin error still persist. Then I remove all the node_modules folder, run "npm install" command again, and now everything is fine!

Community
  • 1
  • 1
wcb1
  • 665
  • 1
  • 7
  • 6
2

First Run: npm cache clean

Next: npm rebuild

1

I was having the same problem, running on Windows 2012 R2. I ended up just opening up powershell, navigating to the folder where my .csproj file was located and then I executed the following command:

npm install

Flea
  • 11,176
  • 6
  • 72
  • 83