Reputation: 521
Please tell me how i can solve it. Iam using window 7 32 bit:
Upvotes: 52
Views: 203138
Reputation: 50
For me it was as simple as NOT using sudo
before the npm
command - so, if you were trying to copy/paste some commands from the net, try them without the sudo
.
Upvotes: 0
Reputation: 1505
Since terminal.integrated.shellArgs.linux
is now deprecated, the current solution is as follows:
settings.json
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
"icon": "terminal-bash",
"args": ["-l"]
}
},
"terminal.integrated.defaultProfile.linux": "bash"
That's it, you're done.
Upvotes: 1
Reputation: 155
If you just installed your node while your VScode was running. Restart your vscode it should start working.
Upvotes: 9
Reputation: 1
I had this issue too and I'm running QubesOS which uses virtualization. I could manage to get it running until I'd a standalone VM. That solved my problem. Just mentioning for the ppl using virtualization like virtual box or VMware.
Upvotes: 0
Reputation: 113
As you're aware, you can configure your environment variables in windows at 2 levels.
When VS code is started, it picks the variables in path at a user level and not at system level because you haven't run the application as Administrator.
Just copy-paste your node path from System Variables to User Variables
This does the trick for windows.
Thanks.
Upvotes: 4
Reputation: 178
I needed to kill the terminal in VS Code and restart a new terminal to get npm to show as installed.
Upvotes: 4
Reputation: 1059
For me, restarting VS code and even my PC didn't work, but after restarting VS code via "reload" (not restart, not refresh) from ctrl+shift+P, then in the top right of the terminal clicking the leftmost button and clicking "kill terminal" then restarting VS code it worked.
Upvotes: 0
Reputation: 3949
On Mac OS , I switched to the zsh and got this fixed. These following steps fixed the issue :
shift + command + P
.Terminal: Select Default Profile
, then "Click it". Note, as you type you will find this option in the auto-complete .now npm
will work in your vscode terminal.
Upvotes: 56
Reputation: 97
On mac, I switched the default shell from bash to zsh and it fixed the issue.
Upvotes: 3
Reputation: 3293
By default, Visual Studio Code runs shell commands like npm
in a loginless shell. If you installed NVM, Visual Studio Code may have no indication where to find npm
to run it.
Put the following lines are in .bash_profile
: (Note: Not .bashrc
.)
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
Add this setting to settings.json
:
"terminal.integrated.shellArgs.linux": ["-l"]
Upvotes: 39
Reputation: 993
I'm gonna add an answer just for help others because this question is 2 years old.
If you can run the npm start (NPM SCRIPTS below the Explorer view) but you are not able to launch the command with a shortcut: Then check npm extension is installed and/or enabled for the current workspace/folder.
Otherwise vsCode will not be able to run the script and you're going to get a message in a little box like this
command 'npm-script.start' not found
Maybe the NPM Scripts View below the explorer is not available without the plugin I'm not sure
Upvotes: 1
Reputation: 486
I got this error after having just installed nodejs/npm, and the way i resolved, while still being able to use git bash terminal in vscode was to simply restart my computer (I hadn't done this after node installation).
Upvotes: 16
Reputation: 375
I too had this issue. To solve this follow the below steps. Make sure you have npm installed - go to command prompt & type npm -v - if a version comes out it's installed, else go to https://nodejs.org/en/ and download same. Then come to vs code and set deafult shell to cmd. to do so, - Press Ctrl+Shift+P and type Select Default Shell - Select Command Prompt. - Press Ctrl+` - Type npm -v and see npm works. :)
Upvotes: 22
Reputation: 1598
You need to install npm first, https://www.npmjs.com/get-npm and make sure npm command is accessible using terminal/command prompt.
You can also use https://marketplace.visualstudio.com/items?itemName=eg2.vscode-npm-script This extension supports running npm scripts defined in the package.json file and validating the installed modules against the dependencies defined in the package.json.
Upvotes: 1