VSCode任务错误:/bin/bash:npm:找不到命令 [英] VSCode tasks error: /bin/bash: npm: command not found
问题描述
我一直在使用node和npm.但是,现在,何时执行 command
shift
p
,任务:运行任务
, npm build
,我收到此错误消息:
I've been using node and npm forever. Right now, however, when do command
shift
p
, Tasks: Run task
, npm build
, I get this error message:
执行任务:npm install<
Executing task: npm install <
/bin/bash:npm:找不到命令终端进程终止,退出代码为:127
/bin/bash: npm: command not found The terminal process terminated with exit code: 127
终端将被任务重用,按任意键将其关闭.
Terminal will be reused by tasks, press any key to close it.
在终端中,node和npm可以正常工作.我什至尝试运行/bin/bash;
node -v
,而且效果很好.
In the terminal, node and npm work fine. I even tried running /bin/bash;
node -v
and that works fine.
推荐答案
我找到了解决方案.我必须告诉 nvm
默认节点版本,因为在出现此错误之前我已经卸载了版本.看到这里: https://stackoverflow.com/a/34777308/1404347
I found the solution. I had to tell nvm
the default node version because I uninstalled a version before I had this error. See here: https://stackoverflow.com/a/34777308/1404347
这篇关于VSCode任务错误:/bin/bash:npm:找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!