NPM not found when using NVM

China☆狼群 提交于 2019-12-01 02:30:30
Raphaël

I found out that this was a conflict with a previous versions of npm that have not been removed properly despite a apt-get remove node.

I solved it by reinstalling npm from scratch:

rm -R ~/.npm ~/.nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
nvm install node

I found the solution here.

I fixed this by doing this command:

$ command -v npm

and then reopen the shell window.

This problem especially happens in windows which happens because of missing admin rights for cmd.

If you are using Git bash

  1. Go in installation directory e.g C:\Program Files\Git
  2. Right click properties -> compatibility.
  3. Tick the checkbox with label -> Run as administrator.
  4. Run the git bash again & execute npm list and then npm use 'version_to_be_used'

Same goes for Cmd

Install node using node source distribution:

curl -sL https://deb.nodesource.com/setup_[version].x | bash -
apt-get install -y nodejs

[version] = the wanted version. See the repository to choose the correct: NodeSource Node.js Binary Distributions

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!