
Halo, kalau kamu merasa tulisan saya ngebantu, kamu bisa ucapkan terima kasih lewat saweria .
If you feel this website help you, you can donate at saweria .
Node or NPM Not Found When You Use NVM
-
Auto completion was already exist at
.bashrc
, -
You’re already running this manually
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
- Try run
source ~/.bashrc
but why still cannot runnode
ornpm
command?
Here’s how to solve that problem:
-
You can check node version that already installed on server using
nvm ls
-
If nothing installed, you can install nodejs 18,
nvm install lts/hydrogen
ornvm install v18.16.0
for install specific version -
If you already installed node, but still cannot run
node
ornpm
, you need to set default node version at server.Run
nvm alias default lts/hydrogen
ornvm alias default v18.16.0
NPM/Node Not Found When Running Github Actions or Gitlab CI/CD
- You need to add this line at
script
.
.
.
script: |
cd /home/admin/node/
#you need to add this
export NVM_DIR=~/.nvm
#and this one
source ~/.nvm/nvm.sh
npm install --omit=dev
.
.
.