Saturday, 15 March 2014

node.js - Getting npm: command not found. How do I reinstall NPM when Node is already installed? Where did NPM go? -



node.js - Getting npm: command not found. How do I reinstall NPM when Node is already installed? Where did NPM go? -

i'm starting learn build modern web apps angularjs tutorial , running issues early.

i have node installed:

/path/ang-news node -v v0.10.26

i using npm before running problem yeoman. i've repeated these steps while grunt stopped working started fresh.

i ran:

$ sudo npm install -g generator-angular

and dependencies installing until received:

npm warn package.json mongo@0.1.0 no repository field. npm err! peerinvalid bundle generator-karma not satisfy siblings' peerdependencies requirements! npm err! peerinvalid peer generator-angular@0.9.1 wants generator-karma@>=0.8.2

i tried updating:

$ npm update -g

i should have run administrator. received tons of error messages, seemed pertinent:

npm err! please seek running command 1 time again root/administrator. npm err! scheme darwin 13.1.0 npm err! command "/usr/local/bin/node" "/usr/local/bin/npm" "update" "-g" npm err! cwd /path/ang-news npm err! node -v v0.10.26 npm err! npm -v 1.4.3 npm err! not ok code 0

then tried uninstalling generator-karma , starting fresh:

$ sudo npm uninstall -g generator-karma

but received:

sudo: npm: command not found $ npm -v -bash: /usr/local/bin/npm: no such file or directory

my first question is: why did npm disappear?

[edit: kudos @try-catch-finally pointing out havoc ensues when switching between normal user , sudo when issuing commands. turns out messed user environment , npm no longer installed.]

my understanding npm installed when install node, my sec question is: how reinstall npm? i'd prefer not have reinstall node beginning.

[edit: kudos @hawk , @try-catch-finally - doesn't appear installing npm lone option, there easy ways reinstall both.]

if have working node, can re-install npm

curl -l https://npmjs.org/install.sh | sudo sh

unfortunately npm update -g not expects. fixing on npm roadmap, it's going take while.

you never need install bundle globally, unless (like generator-angular or grunt-cli) want utilize bundle command.

node.js angularjs npm bower yeoman-generator-angular

No comments:

Post a Comment