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:
Executing task: npm install <
/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.
In the terminal, node and npm work fine. I even tried running /bin/bash;
node -v
and that works fine.
If you've installed npm globally on your system, and you're getting the error message from VSCode terminal, it might be the terminal that didn't update the VSCode application. Just close all VSCode windows and reopen the application again to reload all of its module – that should be enough to resolve the issue.
You must click the Kill Terminal button (highlighted) and then restart VS Code and node will start working again. Best on making a change of system environment variable Path is restarting Windows to make sure that really all processes make use of the modified Path variable.
Since this is the first result on Google, I want to share my solution despite this being a year old. The problem is that VS Code isn't initializing the NPM command, and many others when using VS Code Tasks. The solution to this is to force VS Code to do so.
This is a very simple thing to do. Simply open up settings.json and add this:
{
"terminal.integrated.shellArgs.linux": [
"-i"
]
}
I know that this thread is a year-old, but it's the first result I found on Google when going on my search, and while AskYous's solution worked for him, it didn't for me.
see comments for changes due to new versions of VSC (1.60.1+?)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With