title: Getting npm: command not found. How do I reinstall NPM when Node is already installed? Where did NPM go?
body: <p>I'm starting <a href="http://thinkster.io">Learn to Build Modern Web Apps with the AngularJS Tutorial</a> and running into issues very early.</p>
  
  <p>I have node installed: </p>
  
  <pre><code>/path/ang-news node -v
  v0.10.26
  </code></pre>
  
  <p>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. </p>
  
  <p>I ran:</p>
  
  <pre><code>$ sudo npm install -g generator-angular
  </code></pre>
  
  <p>and all the dependencies were installing until I received:</p>
  
  <pre><code>npm WARN package.json mongo@0.1.0 No repository field.
  npm ERR! peerinvalid The package generator-karma does not satisfy its siblings' peerDependencies requirements!
  npm ERR! peerinvalid Peer generator-angular@0.9.1 wants generator-karma@&gt;=0.8.2
  </code></pre>
  
  <p>I then tried updating: </p>
  
  <pre><code>$ npm update -g
  </code></pre>
  
  <p>I should have run this as an administrator. I received tons of error messages, this seemed most pertinent:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>Then I tried uninstalling generator-karma and starting fresh:</p>
  
  <pre><code>$ sudo npm uninstall -g generator-karma
  </code></pre>
  
  <p>but received: </p>
  
  <pre><code>sudo: npm: command not found
  
  $ npm -v
  -bash: /usr/local/bin/npm: No such file or directory
  </code></pre>
  
  <p><strong>My first question is: Why did NPM suddenly disappear?</strong></p>
  
  <p>[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.] </p>
  
  <p>My understanding is that NPM is installed when you install Node, so <strong>my second question is: How do I reinstall just NPM?</strong> I'd prefer not to have to reinstall Node from the beginning.</p>
  
  <p>[EDIT: Kudos to @hawk and @try-catch-finally - it doesn't appear that installing NPM alone is an option, but there are <a href="https://gist.github.com/isaacs/579814">easy ways to reinstall both</a>.] </p>