“反应 - 本机链接错误文件 C:\Users\pc\AppData\Roaming\npm\react-native.ps1 无法加载”

Nic*_*ono 3 oauth-2.0 react-native

错误信息:

react-native : File C:\Users\pc\AppData\Roaming\npm\react-native.ps1 cannot be loaded. The
file C:\Users\pc\AppData\Roaming\npm\react-native.ps1 is not digitally signed. You cannot run
this script on the current system. For more information about running scripts and setting
execution policy, see about_Execution_Policies at
https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ react-native link
+ ~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?我已经安装了 npm、Node.js 和 JDK。我已经完成了Okta身份验证的教程,并且在反应本机链接步骤中出现此错误。

小智 11

尝试将 PowerShell 中的执行策略设置为远程\n签名。

\n

打开新的 PowerShell 管理员窗口并运行Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser.

\n

\xe2\x80\x99s 还有一种允许在 Windows 上的“设置”中运行 PowerShell 脚本的方法,但我不记得\xe2\x80\x99 在哪里。可能在开发者设置中。

\n