1

I use NVM on my Mac (10.11.6) to manage different nodeJS version. But today, when I run

nvm use 4.8
Now using node v4.8.4 (npm v2.15.11)
node -v
-bash: nodejs: command not found

I just reinstall NVM like that : http://dev.topheman.com/install-nvm-with-homebrew-to-use-multiple-versions-of-node-and-iojs-easily/ but same error: nodejs: command not found. I tried in root, with a reboot but always the same error.

Does anyone had the same problem ?

Thanks.

  • Try `which node` to see where it is looking for node command. Then investigation nvm configuration to check why that path is being used. Maybe you will find the answer in super user or ask different for this. –  Jul 27 '17 at 12:09
  • I just completly uninstall node, npm, nvm. I update my MacOS version to Sierra. Same error: `MacBook-Pro-de-Kevin-2:~ kevinthenard$ nvm install 0.12 Downloading and installing node v0.12.18... Downloading https://nodejs.org/dist/v0.12.18/node-v0.12.18-darwin-x64.tar.gz... ######################################################################## 100,0% Computing checksum with shasum -a 256 Checksums matched! Now using node v0.12.18 (npm v2.15.11) Creating default alias: default -> 0.12 (-> v0.12.18) MacBook-Pro-de-Kevin-2:~ kevinthenard$ node -v -bash: nodejs: command not found` – Kévin Thenard Jul 28 '17 at 12:20
  • Possible duplicate of [nvm keeps "forgetting" node in new terminal session](https://stackoverflow.com/questions/24585261/nvm-keeps-forgetting-node-in-new-terminal-session) – Leon Oct 11 '18 at 10:05

3 Answers3

1

Try to find and remove line alias node=nodejs in ~/.bashrc or ~/.bash_profile

redexp
  • 4,765
  • 7
  • 25
  • 37
  • @ZiaUlRehmanMughal `alias` is a shortcut for some command, when you type something, first of all bash looks is it alias and only after that it trying to find program in PATH directories. google it `bash aliases` – redexp Oct 07 '20 at 06:47
  • I know bash aliases, but shouldn't it work despite being nvm's path loaded later in the bashrc? I guess UNIX gives preference to alias and alias does not cater for the scenario that if something gets loaded in the PATH after alias is declared. If thats so, than it makes sense. – Zia Ul Rehman Mughal Oct 07 '20 at 12:30
0

You can refer this link to install NodeJS using NVM. Make sure that you have not missed any step. Also, try the command "locate .nvm" to look for the NVM configuration files.

  • It's a Linux version of install, but main of this guild is the same as I do (exept I use brew to install, but I tried with a .sh version, same error) – Kévin Thenard Jul 28 '17 at 12:30
0

Run nvm alias default NODE_VERSION. Put your version in place of NODE_VERSION. For Example nvm alias default 14 or nvm alias default 14.19.3.