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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 18:24:56  来源:igfitidea点击:

bash: npm: command not found?

node.js

提问by Deo

I'm learning laravel and follwing this tutorial,

我正在学习 Laravel 并遵循本教程

But when I went try and install npm, is says bash: npm: command not found

但是当我去尝试安装 npm 时,说 bash: npm: command not found

enter image description here

在此处输入图片说明

采纳答案by Neodan

Just go into npm pageand follow the instructions.

只需进入npm 页面并按照说明操作即可。

回答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

I also come here for the same problem, The solution I found is to install npmand then restart the Visual Studio Code

我也遇到同样的问题,我找到的解决方案是安装npm然后重新启动Visual Studio Code

回答by Ibrahim Max Alyousfi

I am following the same tuturial and I had this issue and how I solved is just download the

我正在关注相同的教程,我遇到了这个问题,我的解决方法是下载

8.11.4 LTS version

8.11.4 长期支持版本

from this linkthen install it then the command worked just fine!

这个链接然后安装它然后命令工作得很好!

回答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 命令。

回答by an-apluss

If you already installed npmglobally on your system, and you are still getting the above error message by using VSCode terminal. Just close your VSCode applicationand reopen again, that should resolve the issue.

如果您已经在系统上全局安装了npm,并且使用VSCode 终端仍然收到上述错误消息。只需关闭您的VSCode 应用程序并再次重新打开,即可解决问题。