I'm starting Learn to Build Modern Web Apps with the AngularJS Tutorial and running into issues very early.
I have node installed:
/path/ang-news node -v
v0.10.26
I was using NPM earlier but was running into trouble with Yeoman. I've repeated these steps a while back but Grunt stopped working so I started fresh.
I ran:
$ sudo npm install -g generator-angular
and all the dependencies were installing until I received:
npm WARN package.json [email protected] No repository field.
npm ERR! peerinvalid The package generator-karma does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants generator-karma@>=0.8.2
I then tried updating:
$ npm update -g
I should have run this as an administrator. I received tons of error messages, this seemed most pertinent:
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System 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 I tried uninstalling generator-karma and 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 suddenly disappear?
[EDIT: Kudos to @try-catch-finally to pointing out the havoc that ensues when switching between normal user and sudo when issuing commands. It turns out that I messed up my user environment and NPM was no longer installed.]
My understanding is that NPM is installed when you install Node, so my second question is: How do I reinstall just NPM? I'd prefer not to have to reinstall Node from the beginning.
[EDIT: Kudos to @hawk and @try-catch-finally - it doesn't appear that installing NPM alone is an option, but there are easy ways to reinstall both.]
$ npm update -g
as you wrote looks wrong, if you deal with global packages, you'll need to run this as root too. Funny: you then usedsudo
but did anothernpm
command. Maybe you've messed up the user environment? Can you please check that/usr/local/bin/npm
is really not existing? Please try tofind /usr
it. On the original errorPeer [email protected] wants generator-karma@>=0.8.2
: It looks like thegenerator-angular
guys updated the dependencies which are not present in the repo (I came across such problems). – Peden$ find/usr npm
-bash: find/usr: No such file or directory
` Good to know that I'm not the only one that run into the issues with updated dependencies not in the repo. Thanks! – Shannonshanny./configure; make; make install
? Who owns/usr/local/bin/npm
?root.root
? – Pedenfind /usr
(a space betweenfind
and the path)! Please fly-in your mind ;) Please also issuewhereis node
andwhereis npm
too to show all path providingnode
andnpm
. --- Please add your observations to your post by editing it! – Peden