node.js bash: npm: 命令未找到?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45585029/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
bash: npm: command not found?
提问by Deo
回答by Black Mask
If you have already installed nodejs and still getting this error. npm: command not found..
如果您已经安装了 nodejs 并且仍然收到此错误。npm:找不到命令..
run this
运行这个
apt-get install -y npm
回答by Naimur Hasan
回答by Ibrahim Max Alyousfi
回答by Omid Ahmadyani
in redhat base OS (tested in centos 7)
在 redhat 基础操作系统中(在 centos 7 中测试)
yum install nodejs npm -y
in debian base OS
在 debian 基础操作系统中
apt-get install -y npm
回答by gallo2000sv
I know it's an old question. But it keeps showing in google first position and all it says it's "install node.js". For a newbie this is not obvious, so all you have to do is go to the node.js website and search for the command for your linux distribution version or any other operating system. Here is the link: https://nodejs.org/en/download/package-manager/
我知道这是一个老问题。但它一直显示在谷歌的第一位置,并且它说它是“安装 node.js”。对于新手来说,这并不明显,因此您要做的就是访问 node.js 网站并搜索适用于您的 linux 发行版或任何其他操作系统的命令。这是链接:https: //nodejs.org/en/download/package-manager/
In this page you have to choose your operating system and you'll find your command. Then you just log into your console as a root (using putty for instance) and execute that command.
在此页面中,您必须选择操作系统,然后才能找到您的命令。然后,您只需以 root 身份登录控制台(例如使用 putty)并执行该命令。
After that, you log as normal user and go again inside your laravel application folder and run again npm install command, and it should work. Hope it helps.
之后,您以普通用户身份登录并再次进入 Laravel 应用程序文件夹并再次运行 npm install 命令,它应该可以工作。希望能帮助到你。
回答by Gabriela Mancini
You need to install Node . Visiti this link
您需要安装 Node 。访问此链接
[1]: https://nodejs.org/en/and follow the instructions.
[1]:https: //nodejs.org/en/并按照说明进行操作。
回答by Mirza Sisic
In my case it was entirely my fault (as usual) I was changing the system path under the environment variables, in Windows, and messed up the path for Node/NPM. So the solution is to either re-add the path for NPM, see this answeror the lazy option: re-install it which will re-add it for you.
在我的情况下,这完全是我的错(像往常一样)我在 Windows 中更改了环境变量下的系统路径,并弄乱了 Node/NPM 的路径。因此,解决方案是重新添加 NPM 的路径,请参阅此答案或惰性选项:重新安装它将为您重新添加它。
回答by blueboy21
The solution is simple.
解决方法很简单。
After installing Node, you should restart your VScode and run npm install command.
安装 Node 后,您应该重新启动 VScode 并运行 npm install 命令。


