简体   繁体   English

无论我尝试什么,npm'找不到命令'

[英]npm 'command not found' no matter what I try

On MacOS: 在MacOS上:

I'm unable to execute any npm package command. 我无法执行任何npm package命令。 Every time I try, I see command not found. 每次尝试时,都会看到找不到命令。 Like so: 像这样:

-bash: live-server: command not found

I've installed node.js directly from the website. 我已经直接从网站安装了node.js。 https://nodejs.org/en/download/ https://nodejs.org/en/download/

I've installed live-server globally, and locally. 我已经在全球和本地安装了实时服务器。 It appears to work. 它似乎起作用。 When I try the command, it fails. 当我尝试该命令时,它将失败。

I've removed node.js and npm, re-installed and still fail to execute a command. 我删除了node.js和npm,重新安装后仍然无法执行命令。 I'm quite stumped. 我很沮丧。 I've reviewed similar posts, implemented the suggested solutions and still can't manage to execute any npm command. 我查看了类似的帖子,实现了建议的解决方案,但仍然无法执行任何npm命令。 Several of the posts I've reviewed: sudo: npm: command not found 我查看过的几篇文章: sudo:npm:找不到命令

NPM Command Not Found After Installing Node 安装节点后找不到NPM命令

What should I do next? 接下来我该怎么办?

Are you using Windows? 您在使用Windows吗? Did you check if NPM is in Path on "Environments variable" 您是否检查过NPM是否在“环境变量”上的路径中

My bash_profile file had the wrong data saved. 我的bash_profile文件保存了错误的数据。 Correcting the file solved the problem. 更正文件即可解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM