title: Installing npm modules globally without using sudo and updating the npmrc to install on the specified folder
body: <p>I wanted to install npm modules globally and it is not recommended to use <code>sudo</code> with it:
  And this <a href="https://stackoverflow.com/q/18212175/1328014">question : npm / yeoman install generator-angular without sudo</a> is the solution to it.</p>
  
  <p>I followed this</p>
  
  <pre><code>echo prefix = ~/.node &gt;&gt; ~/.npmrc
  </code></pre>
  
  <p>And add this to my <code>.bashrc</code> file</p>
  
  <pre><code>export PATH=$HOME/.node/bin:$PATH
  </code></pre>
  
  <p>Now I have to install a global module, for example <code>express-generator</code></p>
  
  <pre><code>npm install -g yo
  </code></pre>
  
  <p>But I am still getting an <code>EACCESS</code> error, and as read the log, it seems like npm is still installing global modules to the <code>/usr/lib/node_modules/</code> instead of <code>~/.node/</code></p>
  
  <pre><code>Error: EACCES, mkdir '/usr/lib/node_modules/express-generator'
  </code></pre>