Problems when installing Node on OSX with brews, the default node path on OSX. For some reason my node modules where all installed in /Users//.npm_packages and Node Modules end up here
/Users//.npm_packages/lib/.node_modules
This result in a lot of errors when i try to install JS-Minify for Sublime Text. special if i install modules Globally.
This is a BlogLog post to reproduce the path if sometime a similar Error occurs in my node environment. At the end you find the stackoverflow links who helped to solve most problems
Installing node through Homebrew can cause problems with npm for globally installed packages. . Set the nvm default Dir DONT use Sudo List Global NPM Packages Will show the global installation root regardless of current working directory. brew info node killall Finder and at the end set back to hide the files again defaults write com.apple.finder AppleShowAllFiles FALSE killall Finder Installing Node MAC Linux Nodeschool Complete Unistall & reinstall Node Install Minify for Sublime Text Source : DAnHerbert GIST
$ rm -rf /usr/local/lib/node_modules
$ brew uninstall node
$ brew install node --without-npm
$ echo prefix=~/.npm-packages >> ~/.npmrc
$ curl -L https://www.npmjs.com/install.sh | sh
</code></p>
<p>to the new npm to PATH environment variable
<code class="prettyprint">$ export PATH="$HOME/.npm-packages/bin:$PATH"</code></p>
<p>To make the new Path permanent we add it to our .bash_profile add following line
<code>
#NODE GLOBAL PATH
PATH=$HOME/.npm-packages/bin:$PATH
</code></p>
<p>Reload the bash in Terminal</p>
<p><code>source ~/.bash_profile</code></p>
<p>Check PATH
<code>$ echo $PATH</code></p>
<p>Edit $PATH</p>
<p><span>vi $HOME/.bash_profile</span></p>
<h2>NODE Commands:</h2>
<p><code>$ npm config get prefix</code></p>
<p><strong><em>Show Version</em></strong></p>
<p>$ npm -v</p>
<p><strong><em>Show node Version</em></strong></p>
<p><span>$ node –version </span></p>
<p><em><strong>Get Path where NPM is installed</strong></em></p>
<pre class="lang-js prettyprint prettyprinted"><code><span class="pln">$ npm config </span><span class="kwd">get</span><span class="pln"> prefix</span></code>
$ npm config set prefix /usr/local
$ npm list -gnpm root -g</code><span> </span></p>
<h4 class="gh-header-title instapaper_title">Complete Remove NODE.JS</h4>
<pre class="lang-bash prettyprint prettyprinted"><code><span class="pln">brew uninstall node</span><span class="pun">;</span><span class="pln">
</span><span class="com"># or `brew uninstall --force node` which removes all versions</span><span class="pln">
brew prune</span><span class="pun">;</span><span class="pln">
rm </span><span class="pun">-</span><span class="pln">f </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">bin</span><span class="pun">/</span><span class="pln">npm </span><span class="pun">/</span><span class="pln">usr</span><span class="pun">/</span><span class="kwd">local</span><span class="pun">/</span><span class="pln">lib</span><span class="pun">/</span><span class="pln">dtrace</span><span class="pun">/</span><span class="pln">node</span><span class="pun">.</span><span class="pln">d</span><span class="pun">;</span><span class="pln">
rm </span><span class="pun">-</span><span class="pln">rf </span><span class="pun">~/.</span><span class="pln">npm</span><span class="pun">;</span></code>
Reinstall NODE.JS
brew install node;
which node # => /usr/local/bin/node
export NODE_PATH='/usr/local/lib/node_modules' # <--- add this ~/.bashrc
Get Node info regarding your node installs
Temporary show hidden Files
defaults write com.apple.finder AppleShowAllFiles TRUE
Installing global node modules