+
Skip to content
This repository was archived by the owner on Aug 5, 2024. It is now read-only.
This repository was archived by the owner on Aug 5, 2024. It is now read-only.

Windows Powershell - "running scripts is disabled on this system" when running nexmo #218

Open
@dragonmantank

Description

@dragonmantank

Steps to reproduce

On Windows 10:

  • Install the latest version of NodeJS from https://nodejs.org/en/
  • Install the CLI with nexmo-cli@beta -g
  • Run nexmo

Expected behavior

I should see the help output from the nexmo command.

Actual behavior

nexmo : File C:\Users\chris\AppData\Roaming\npm\nexmo.ps1 cannot be loaded because running scripts is disabled on this
system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ nexmo
+ ~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

This normally occurs when the remote script isn't trusted. I could get it to run by changing my Execution Policy to "RemoteSigned", at which point the CLI worked again:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

It looks like at some point after npm 6.9.0, npm started generating a nexmo.ps1 file to help wrap the node SDK in the event node is installed both under Powershell and Linux. This ps1 file will not run under the default "Restricted" execution policy Windows 10 ships with.

npm 6.9.0 and prior do not generate this file, and worked fine.

Other projects with this same general issue:

System configuration

Node version:
12.16.3

NPM version:
Broken under 6.14.4
Works under 6.9.0

Operating system:
Windows 10 Professional under Powershell

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载