ng serve --open 不能从 Powershell 和 VS 终端(Powershell)工作
ng serve --open not working from Powershell and VS terminal(Powershell)
当我遇到这个问题时,那时我已经尝试从管理员和非管理员的 Pwershell 触发这个命令
遇到这个错误:
'''
ng:无法加载文件 C:\Users\vishi\AppData\Roaming\npm\ng.ps1,因为 运行ning 脚本在此系统上被禁用。想要查询更多的信息,
请参阅 about_Execution_Policies,网址为 https://go.microsoft.com/fwlink/?LinkID=135170。
在 line:1 char:1
- ng 服务 --open
- 类别信息: 安全错误: (:) [], PSSecurityException
- FullyQualifiedErrorId : UnauthorizedAccess
'''
然后我从 CMD 尝试 运行ning,因为这个问题是因为在 Powershell 上应用了安全策略,然后 CMD 显示了这个错误:
'''新命令需要在项目外 运行,但在 C:\Users\vishi\ImprovApp\angular.json" 找到了项目定义。
'''
我的问题是,如果我们不是管理员组的一部分,那么我们就不能更改 PS 安全策略,那么有没有其他方法可以 运行 nodejs Ng 或 npm命令 ????
执行以下命令后:
PowerShell says "execution of scripts is disabled on this system."
安全策略已更新,然后我从 VS 终端触发“ng serve --open”,然后它起作用了。
详情:
执行
Set-ExecutionPolicy RemoteSigned
撤消
>Set-ExecutionPolicy Restricted
当我遇到这个问题时,那时我已经尝试从管理员和非管理员的 Pwershell 触发这个命令
遇到这个错误:
''' ng:无法加载文件 C:\Users\vishi\AppData\Roaming\npm\ng.ps1,因为 运行ning 脚本在此系统上被禁用。想要查询更多的信息, 请参阅 about_Execution_Policies,网址为 https://go.microsoft.com/fwlink/?LinkID=135170。 在 line:1 char:1
- ng 服务 --open
- 类别信息: 安全错误: (:) [], PSSecurityException
- FullyQualifiedErrorId : UnauthorizedAccess '''
然后我从 CMD 尝试 运行ning,因为这个问题是因为在 Powershell 上应用了安全策略,然后 CMD 显示了这个错误:
'''新命令需要在项目外 运行,但在 C:\Users\vishi\ImprovApp\angular.json" 找到了项目定义。 '''
我的问题是,如果我们不是管理员组的一部分,那么我们就不能更改 PS 安全策略,那么有没有其他方法可以 运行 nodejs Ng 或 npm命令 ????
执行以下命令后:
PowerShell says "execution of scripts is disabled on this system."
安全策略已更新,然后我从 VS 终端触发“ng serve --open”,然后它起作用了。
详情: 执行
Set-ExecutionPolicy RemoteSigned
撤消
>Set-ExecutionPolicy Restricted