Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm and pm2 command not working #44

Closed
cakasuma opened this issue Apr 7, 2020 · 4 comments
Closed

npm and pm2 command not working #44

cakasuma opened this issue Apr 7, 2020 · 4 comments

Comments

@cakasuma
Copy link

cakasuma commented Apr 7, 2020

i cant use npm install or pm2 in the script, is there any way to do this

@cakasuma cakasuma changed the title npm and git command not working npm and pm2 command not working Apr 7, 2020
@insign
Copy link

insign commented Apr 7, 2020 via email

@appleboy
Copy link
Owner

See #21

@fcbuz2000
Copy link

npm: command not found
Reason:
I use nvm for the server node environment, and nvm will not install the node environment in the /usr/local/bin/ directory, so that sudo can't find the corresponding instructions, and finally create a soft connection to solve

sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/node" "/usr/local/bin/node"
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/npm" "/usr/local/bin/npm"
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/pm2" "/usr/local/bin/pm2"

you can test "sudo npm -v"

https://blog.csdn.net/weixin_40599109/article/details/110825357

@gulshanAI
Copy link

Find where is your node, npm, and pm2

whereis node
For Me Output
node: /home/abhimanyu/.nvm/versions/node/v18.12.1/bin/node
after that link it via
sudo ln -s "$NVM_DIR/versions/node/v18.12.1/bin/pm2" "/usr/local/bin/pm2"

whereis npm
For Me Output
npm: /home/abhimanyu/.nvm/versions/node/v18.12.1/bin/npm
after that link it via
sudo ln -s "$NVM_DIR/versions/node/v18.12.1/bin/node" "/usr/local/bin/node"

whereis pm2
For Me Output
pm2: /home/abhimanyu/.nvm/versions/node/v18.12.1/bin/pm2
after that link it via
sudo ln -s "$NVM_DIR/versions/node/v18.12.1/bin/npm" "/usr/local/bin/npm"

Here my path is mention your path me be diffrent

This will resolved the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants