VS Code terminal: npm command not functioning after Node.js update

I recently upgraded my Node.js installation to the latest version from the official website. However, I’ve run into a problem. When I try to use the npm -v command in the VS Code terminal, I get an error message saying:

running scripts is disabled on this system

This is odd because I’ve never encountered this issue before. I’ve been using Node.js for about half a year without any problems. It seems this restriction only appeared after the update.

I found some suggestions online about changing the execution policy, but I’m confused. Why would I need to do this now when I didn’t have to do it during my initial Node.js setup?

Has anyone else faced this problem? Is there a way to fix it without messing with system policies? Any help would be much appreciated!

I encountered a similar issue after a recent Node.js update. The problem lies in Windows security measures. While changing execution policies is one solution, it’s not the only option. Here’s what worked for me:

  1. Uninstall Node.js completely.
  2. Download the latest LTS version from the official website.
  3. During installation, ensure you select the option to automatically install necessary tools.
  4. Restart your computer after installation.

This approach resolved the npm command issue without altering system policies. If you’re still facing problems, consider checking your environment variables to ensure the Node.js path is correctly set. Remember to close and reopen VS Code after making any changes.

hey there! i had the same issue after updating. turns out it’s a security thing. try running powershell as admin and use this command: Set-ExecutionPolicy RemoteSigned

it worked for me without any probs. if ur uncomfortable changing policies, maybe try reinstalling node? good luck!

I’ve been through this exact situation, and it can be frustrating. Here’s what worked for me without changing any system policies:

First, I completely uninstalled Node.js from my system. Then, I went to the official Node.js website and downloaded the latest LTS version. During the installation process, I made sure to tick the box that says ‘Automatically install the necessary tools.’

After installation, I rebooted my computer. This step is crucial as it ensures all changes take effect. When I opened VS Code again, the npm commands were working perfectly.

If you’re still having issues, it might be worth checking your PATH environment variable. Sometimes, the update doesn’t correctly set the new Node.js path. You can add it manually if needed.

Hope this helps! Let us know if you need any more assistance.