npm install failing npm install failing shell shell

npm install failing


I have the same error if not privileged, so I must use sudo when using the -g flag

If sudo don't recongize npm you can try:

  • passing the complete route of npm

    $ sudo $(which npm) install -g socket.io
  • preserving the environment with -E flag

    $ sudo -E npm install -g socket.io

Upd:

Note that is recommended to use the -g flag only for executables and install locally (without the flag) the libraries that are required in your code. Privileges are required for copying the executables to /usr/bin or, in your case /usr/local/bin

Note too that in the socket.io site, the -g flag is not included for the installation command ;)

Read more: http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/


If you are on Arch Linux, check out the npm2arch package in the AUR. It will let you install npm packages using pacman.

Example:

npm2archinstall socket.io