The path for nodejs and npm is different

I am using Ubuntu 14.04LTS

I have nodejs (default package) at path / usr / bin / nodejs

I have npm on the path / usr / local / bin / npm

When I run npm -v it says

bash: /usr/local/bin/npm: /usr/local/bin/node: bad interpreter: No such file or directory

      

I tried to install npm using the following command:

$ sudo curl -L https://npmjs.org/install.sh | w

% Total% Received% Xferd Average Speed ​​Time Time Time Current Dload Load Total Spent Left Speed ​​100 193 100 193 0 0 159 0 0:00:01 0:00:01 -: -: - 160 100 6711 100 6711 0 0 3028 0 0:00:02 0:00:02 -: -: - 8876 npm cannot be installed without nodejs. install node and then try again.

Maybe node is installed but not in PATH? Note that sudo can change envs.

What can be done to run npm here?

+3


source to share


1 answer


First uninstall current nodes nodejs and npm, then install nvm (Node Version Manager).
To install:

$ curl https://raw.githubusercontent.com/creationix/nvm/v0.17.1/install.sh | bash

      



nvm is a version manager similar to rvm

(ruby) and gvm

(groovy)

-1


source







All Articles