Differences between revisions 1 and 2
Revision 1 as of 2013-11-11 23:04:59
Size: 1248
Editor: JoshSoref
Comment: npmrc based on http://justjs.com/posts/npm-link-developing-your-own-npm-modules-without-tears
Revision 2 as of 2013-11-13 20:52:00
Size: 1256
Editor: JoshSoref
Comment: fixing npmrc
Deletions are marked like this. Additions are marked like this.
Line 11: Line 11:
  echo prefix = %HOMEDRIVE%%HOMEPATH% > "%HOMEDRIVE%%HOMEPATH%\.npmrc"   echo prefix = %HOMEDRIVE%%HOMEPATH%\npm > "%HOMEDRIVE%%HOMEPATH%\.npmrc"
Line 22: Line 22:
  echo prefix = $HOME > ~/.npmrc   echo prefix = $HOME/npm > ~/.npmrc

.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)