Reputation: 947
I have an issue on node.js debugging on vscode, it no matter what I do persists on a particular node.js version on nvm.
lets say I have the following simple launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "webpack launch",
"program": "npx",
"args": [
"webpack",
"serve",
"--config",
"config/webpack.config.dev.js",
"--port",
"3051",
],
"autoAttachChildProcesses": true,
"stopOnEntry": true
},
note: this has been working completely fine until I recently changed nvm version mainly I use and on an other computer.
if you run the above "webpack launch" debug, in the debug console, it shows:
/home/user/.nvm/versions/node/v13.10.1/bin/node npx webpack serve --config config/webpack.config.dev.js --port 3051
well, I'm not using v13.10.1 anymore, but v17.9.0. I'm saying this for a countless times, vscode. lets do the steps I'm doing to tell vscode to not to use the old version but the v17.9.0 version:
added nvm use v17.9.0
in the last line
ran nvm alias default v17.9.0
added nvm use v17.9.0
in ~/.nvmrc
reload vscode and/or quit vscode then restart vscode.
check if nvm working by checking its version on the newly opened vscode instance terminal.
$ nvm current
v17.9.0
$ node -v
v17.9.0
the same. wow.
/home/user/.nvm/versions/node/v13.10.1/bin/node npx webpack serve --config config/webpack.config.dev.js --port 3051
Process exited with code 1
What tf is going on with vscode? What am I missing here, may I know? Thanks.
Upvotes: 1
Views: 6306
Reputation: 85
Have you tried nvm alias default node
?
Or also, nvm alias default <node version without "V", just the number>
?
Instead of nvm alias default v17.0.0
, nvm alias default 17
Upvotes: 0
Reputation: 45
I have checked and found out my vscode is reflecting the same version I am changing from the terminal outside the vscode terminal. SO it's working for me let's try some steps for you to fix this problem:
There are lots of this kind of scenerios when vscode terminal don't reflect the changes but it gets fixed by just restarting the terminal again in vscode which is not happening in your case. But I hope these 3 steps will help you to get it fixed.
Upvotes: 0