cli
cli copied to clipboard
[BUG] [Windows] PowerShell Execution Policy prevents running the script
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
.ps1shim.
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
- Be on Windows, not WSL.
- Use PowerShell
- Run
npm i -g @superfaceai/cli - Run
superface
Your Environment
- Windows 10
- PowerShell
- Node v12.16.3
- npm v7.12.0