node.jswindowsnpmnpm-scriptsgroup-policy

How can I fix a group policy error running NPM RUN scripts on Windows 10


I'm receiving the following group policy error when I try to run NPM scripts in my project:

PS C:\Users\reir8p\code\whiteboard\frontend> npm run start

> whiteboard@0.0.0 start
> ng serve

This program is blocked by group policy. For more information, contact your system administrator.

If I execute the command directly, I do not receive any errors.

PS C:\Users\reir8p\code\whiteboard\frontend> ng serve

\ Generating browser application bundles... {works as expected}

The relevant lines of my package.json file is:

{
  "name": "whiteboard",
  "version": "0.0.0",
  "scripts": {
     "start": "ng serve",
  },
  ...

I am able to successfully execute > npm run start from "Windows PowerShell" as an administrator. I haven't been able to find any relevant sections in my Windows security policies.

I get the same error with other NPM scripts as well. I also received a similar "This program is blocked..." error when trying to install Anaconda, which I think might be related.

Has anyone else received a similar error or know where I should look to troubleshoot? Thank you.


Solution

  • In our case Applocker blocked the execution.

    Please check the Windows Eventlog (Event viewer/Applications and Services Logs/Microsoft/Windows/AppLocker/MSI and Scripts).