-
-
Notifications
You must be signed in to change notification settings - Fork 602
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 command not found #21
Comments
I encountered a similar problem where Maven (Java Build Tool) was not available within my SSH session but installed on the server:
|
i have this error too. |
@yy921010 try this, fixed my problem script: |
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
npm --help
|
thanks!! |
Fixed it for me as well! Thank you. Do you know why this fixed the problem? |
i think because docker not export environment |
Why is it not loading the users .bashrc correctly? |
npm: command not found sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/node" "/usr/local/bin/node" you can test "sudo npm -v" https://blog.csdn.net/weixin_40599109/article/details/110825357 |
@nathanhannig, maybe script: |
exec bash
pm2 reload app.js |
thanks for the information @vanyauhalin script: |
exec bash \-l
cd ~/project-dir
./deploy.sh it seems what "appleboy/ssh-action" underline do is a sh shell, not a bash shell. it's similar to ssh a@b -t sh |
None of the above worked for me. |
Hello all, I have been facing the same issue. @oshanz pointed out well that when logging through the SSH, the shell is in an interactive mode instead of a login mode. So, some profile information and paths are not loaded. More on this issue here. In any case, I managed to get it working with a here document syntax: script: |
bash -l -c "$(cat <<- EOF
echo "This should work"
EOF
)" There's just one issue, I keep getting this error I think this might also be a (bit hacky) solution for #31. |
This works for me too. |
|
Hey,Gay , I encountered too. So how do you work out? Thank you |
You have to export mvn path, try to use |
Thank you, it is useful; |
I faced similar issues with github actions and building node packages. But nothing helped. I found a workaround: to spawn a docker with same node version, mount on same paths and user. (add your envs if needed)
|
When using exec bash -l in GitHub Actions SSH deployments on Ubuntu 24.04, you may encounter issues with shell initialization. The fix involves modifying the ~/.bashrc file. Find and comment out these lines in your ~/.bashrc: # If not running interactively, don't do anything
[ -z "$PS1" ] && return This modification allows non-interactive shell sessions (like those used in GitHub Actions) to properly load environment variables and shell configurations. The default behavior prevents environment loading in non-interactive shells, which can cause problems with deployment scripts. Credits: https://serverfault.com/questions/936746/bashrc-is-not-sourced-on-ssh-command/1172128#1172128 |
I have npm installed on my server, why does the 'npm command not found' error during deployment?
The text was updated successfully, but these errors were encountered: