cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] [Windows] PowerShell Execution Policy prevents running the script

Open jnv opened this issue 4 years ago • 0 comments

After installing the CLI with npm on Windows, running superface ends up with the following error:

superface : File ...\AppData\Roaming\npm\superface.ps1 cannot be loaded because running scripts is disabled on this system.

Expected Behavior

The CLI should run.

Current Behavior

See above.

Possible Solution

This seems rather to be an issue with NPM since it is responsible for setting up the CLI shims, see e.g. https://github.com/Nexmo/nexmo-cli/issues/218

Two possible solutions include:

  • Changing the execution policy with Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser (other options like RemoteSigned should work as well)
  • Removing the .ps1 shim.

I will dig into this a bit, it's possible this is a particular issue with npm 6 and it's fixed in npm 7, but at the very least we should document this in our docs.

Steps to Reproduce

  1. Be on Windows, not WSL.
  2. Use PowerShell
  3. Run npm i -g @superfaceai/cli
  4. Run superface

Your Environment

  • Windows 10
  • PowerShell
  • Node v12.16.3
  • npm v7.12.0

jnv avatar Sep 03 '21 08:09 jnv