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

  1. Auto completion was already exist at .bashrc,

  2. 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
  1. Try run source ~/.bashrc but why still cannot run node or npm command?

Here’s how to solve that problem:

  1. You can check node version that already installed on server using nvm ls

  2. If nothing installed, you can install nodejs 18, nvm install lts/hydrogen or nvm install v18.16.0 for install specific version

  3. If you already installed node, but still cannot run node or npm, you need to set default node version at server.

    Run nvm alias default lts/hydrogen or nvm alias default v18.16.0


NPM/Node Not Found When Running Github Actions or Gitlab CI/CD

  1. 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
 .
 .
 .