sudo npm install command not found

Viewed 22254

I have installed nodejs and npm in my server (os:amazon ami) using node version manager current node version is 7.10.0 npm version is 4.2.0

nodejs project is located in var/www/testing folder when i am trying to install the depeondeies present in package.json using sudo npm install i got command not found error

Path of node and npm is respectively

~/.nvm/versions/node/v7.10.0/bin/node

~/.nvm/versions/node/v7.10.0/bin/npm

npm and node are in same folder but when I try this command:

sudo npm install I got sudo: npm: command not found

npm install command throws no errors but node_modules folder is empty.

3 Answers

Try To Install Node Using Nvm Node Version Manager From Officai NVM Git Hub Repo

https://github.com/nvm-sh/nvm

git clone https://github.com/nvm-sh/nvm
cd nvm
./installer.sh
nvm install <AnyNodeVersion>


Now Hit Command Line This Method Actually Worked For ME

i Face same Issue And Explained It Here https://stackoverflow.com/questions/67285266/npmcommand-not-found-node-v-is-working-but-for-npm-command-not-found

Related