1
votes

I'm trying to install the Angular 1.5 component router for use in a new project, but having a lot of difficulty. As per https://docs.angularjs.org/guide/component-router, the following should work:

npm install @angular/router --save

Here's what I see:

$ npm install @angular/router --save
npm ERR! Darwin 14.5.0
npm ERR! argv "/Users/JonathanM/.nvm/versions/node/v4.4.2/bin/node" "/Users/JonathanM/.nvm/versions/node/v4.4.2/bin/npm" "install" "@angular/router" "--save"
npm ERR! node v4.4.2
npm ERR! npm  v3.8.6
npm ERR! code E400

npm ERR! 400 Bad Request
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!     /Users/JonathanM/Workspace/my-angular-app/npm-debug.log

With node v4.4.2 and npm v3.8.6.

I feel like I'm on the wrong version of npm or something, because I also can't install angular with the syntax they mention in the docs (npm [email protected] angular --save). When I try, I get a generic Usage: npm <command> error, like it doesn't even recognize the command.

Am I doing something wrong? Did the package(s) get pulled/moved? Any help would be appreciated.

1
I wonder if the problem is that you are not using the main public npm registry? - Pete BD
Wow that's totally what it was! npm config set registry https://registry.npmjs.org/ and retrying npm install @angular/router --save worked! npm still doesn't recognize the npm [email protected] angular --save syntax, but I have angular installed so that's not a big deal. - Jonathan Mellman

1 Answers

1
votes

As @PeteBD suspected in his comment, I was pointing to a private npm repo. I was able to successfully install the router with:

npm config set registry https://registry.npmjs.org/
npm install @angular/router --save