【发布时间】:2019-12-31 14:09:24
【问题描述】:
我在 VSC 中设计网站,PowerShell 是我的默认终端。
在早些时候更新网站并将其部署到 firebase 后,系统提示我更新 firebase 工具 - 我使用 npm 进行了更新。在没有以下错误的情况下,我无法运行/访问任何 firebase 脚本:
firebase : File C:\Users\mada7\AppData\Roaming\npm\firebase.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
firebase
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
我花了几个小时四处寻找,但找不到可靠的答案。许多线程已经有好几年了,我觉得很奇怪,我在过去的一年里直到今天都没有遇到过这个问题。 如果我将默认终端设置为 cmd,我仍然可以访问 firebase 脚本。
假设问题与我一直在工作但现在已更新 vue.js 并在尝试在 powershell 中运行任何 vue 命令时再次出现错误的 firebase-tools 相关:
vue : File C:\Users\mada7\AppData\Roaming\npm\vue.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
vue
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
VSCode Version:
Version: 1.37.1 (user setup)
Commit: f06011a
Date: 2019-08-15T16:17:55.855Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362
OS Version:
Windows 10 Home
Version - 1903
OS build - 18362.295
我一直在阅读并看到许多关于脚本权限的线程,但我没有更改任何内容 - 实际上,PowerShell 脚本一直有效,直到我更新了我的包。同时没有触及其他设置。我不想不必要地更改 PowerShell 设置。
【问题讨论】:
-
这个问题开始于 2019 年 11 月左右使用 npm 的几个应用程序。那时 npm 开始使用 powershell 脚本。请参阅this npm 拉取请求和此后续 npm 问题 470。github.com/npm/cli/issues/470
标签: firebase powershell vue.js npm visual-studio-code