我正在使用 Firebase 设置一个新项目,然后运行命令 firebase init functions
,我收到以下错误。
firebase : File C:\Users\fudge\AppData\Roaming\npm\firebase.ps1 cannot be loaded. The file C:\Users\fudge\AppData\Roaming\npm\firebase.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
+ firebase init functions
+ ~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
我知道我可以跑
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
允许它运行,但这似乎很危险,因为我想如果我的 PC 有任何恶意脚本,我也会允许它运行。 Firebase 软件包没有经过数字签名是否有任何理由可以使用
firebase
不改变执行政策?在 init 命令之前我只使用了这三个命令,使用的是 Node v12.14.0:
npm init
npm install firebase-functions@latest firebase-admin@latest --save
npm install -g firebase-tools
最佳答案
我在 VSCode 终端中遇到了同样的错误,所以我将命令运行到命令提示符中,它对我有用。
关于node.js - Firebase 脚本未签名 - Powershell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59505442/