Differences between revisions 2 and 3
Revision 2 as of 2013-11-13 20:52:00
Size: 1256
Editor: JoshSoref
Comment: fixing npmrc
Revision 3 as of 2014-01-08 15:03:36
Size: 1563
Editor: AndrewGrieve
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Using nvm =

Not sure if this works on Windows.
{{{
curl https://raw.github.com/creationix/nvm/master/install.sh | sh
source ~/.bash_profile
nvm install 0.10
nvm alias default 0.10
}}}

This will put all of your node modules within your home directory, and so will not require SUDO at all.

Using nvm

Not sure if this works on Windows.

curl https://raw.github.com/creationix/nvm/master/install.sh | sh
source ~/.bash_profile
nvm install 0.10
nvm alias default 0.10

This will put all of your node modules within your home directory, and so will not require SUDO at all.

.npmrc

To install modules for Node.js, you use npm, which has a configuration file .npmrc.

By default, instructions relating to npm tend to result in you needing to be root / Administrator and involve -g. There are a number of disadvantages to this.

Windows

  • Run the following:
      echo prefix = %HOMEDRIVE%%HOMEPATH%\npm > "%HOMEDRIVE%%HOMEPATH%\.npmrc"
      md "%HOMEDRIVE%%HOMEPATH%\npm"
      md "%HOMEDRIVE%%HOMEPATH%\npm\bin"
  • You will want to add %HOMEDRIVE%%HOMEPATH%\npm\bin to your PATH environment variable, either on a per cmd basis, or by using the environment editor under My Computer properties.

Everything else

  • Run the following:
      echo prefix = $HOME/npm > ~/.npmrc
      mkdir ~/npm
      mkdir ~/npm/bin
  • You will want to add ~/npm/bin to your PATH environment variable, either on a per sh basis, or by editing ~/.profile, ~/.bashrc, or a similar script.

For more information

npm_rc (last edited 2014-01-08 15:03:36 by AndrewGrieve)