当前位置:网站首页>输入cnpm -v出现cnpm : 无法加载文件 C:\Users\19457\AppData\Roaming\npm\cnpm.ps1,因为在此系统上禁止运行脚本。
输入cnpm -v出现cnpm : 无法加载文件 C:\Users\19457\AppData\Roaming\npm\cnpm.ps1,因为在此系统上禁止运行脚本。
2022-07-24 02:16:00 【柠檬气泡水~】
今天安装完cnpm,查看版本时报错如下:
cnpm : 无法加载文件 C:\Users\19457\AppData\Roaming\npm\cnpm.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execu
tion_Policies。
所在位置 行:1 字符: 1
+ cnpm -v
+ ~~~~
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess

解决办法:
1、windows+r输入PowerShell
2、输入 set-ExecutionPolicy RemoteSigned回车
3、根据提示,输入A,回车
4、再输入 get-ExecutionPolicy直到看到RemoteSigned就成功了。
如果第2步中输入“ set-ExecutionPolicy RemoteSigned”回车报错如下:
set-ExecutionPolicy : 对注册表项“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell”的
访问被拒绝。 要更改默认(LocalMachine)作用域的执行策略,请使用“以管理员身份运行”选项启动 Windows PowerShell。要更改当
前用户的执行策略,请运行 "Set-ExecutionPolicy -Scope CurrentUser"。
所在位置 行:1 字符: 1
+ set-ExecutionPolicy RemoteSigned
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (:) [Set-ExecutionPolicy], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyComma
nd

解决办法:
1、根据提示输入Set-ExecutionPolicy -Scope CurrentUser
回车以后,输入remotesigned

2、输入Y

3、再次输入 get-executionpolicy 查看 是否解除限制
显示 RemoteSigned 显示成功

ps:不只是cnpm命令,包括pnpm、yarn等这些命令,如果执行时,报这样的错误,都可以通过此方法解决。前提是,如果是用npm命令来安装这些CLI命令工具,必须安装到全局环境中,才能生效。
边栏推荐
- Sword finger offer II 031. Least recently used cache
- Upload files to flash file system through Arduino IDE
- 通过Arduino IDE向闪存文件系统上传文件
- Matplotlib save image to file
- 解决script标签写在元素节点前面无法获取元素节点的问题
- LoadRunner12安装、录制第一个脚本以及代理服务器没有响应解决
- [hiflow] regularly send Tencent cloud SMS sending group
- 2022-07-22: what is the output of the following go language code? A:1; B:1.5; C: Compilation error; D:1.49。 package main import “fmt“ func main() { var i
- College degree want to 0 basic programming after looking for a job feasible?
- WordPress website SEO complete tutorial
猜你喜欢

Use of component El scrollbar

利用宝塔面板计划任务执行自动推送网址到百度收录

Thread pool interview

网络协议详解:TCP Part1

2022-07-22: what is the output of the following go language code? A:1; B:1.5; C: Compilation error; D:1.49。 package main import “fmt“ func main() { var i
![[bdsec CTF 2022] partial WP](/img/00/25c1953a324fbf04e3baf592079978.png)
[bdsec CTF 2022] partial WP

Research and analysis of the third-party dependency library Ag grid

小散量化炒股记|基于多任务爬虫技术, 实现A股实时行情Level1采样

ASP.NET CORE写一个缓存Attribute工具

145-keep-alive的初步使用
随机推荐
氢能创业大赛 | 国华投资董事长刘小奇:发挥风光氢储融一体化优势 高水平承办创业大赛
NETCORE - how to ensure that icollection or list privatization is not externally modified?
LoadRunner12安装、录制第一个脚本以及代理服务器没有响应解决
Writing of graph nodes that trigger different special effects during the day and at night in Tiktok
C -- bit operation
Tdengine helps Siemens' lightweight digital solution simicas simplify data processing process
Excel simple macro
Hydrogen entrepreneurship competition | Liu Xiaoqi, chairman of Guohua Investment: take advantage of the integration of scenery, hydrogen storage and finance to host the entrepreneurship competition a
Try to run this command from the system terminal Make sure that you use the correct
[untitled]
小散量化炒股记|基于多任务爬虫技术, 实现A股实时行情Level1采样
组件el-scrollbar的使用
Install go environment under Kali
Quick sort considerations
Halide::Generator生成器使用说明
什么叫裸写SQL?express操作mysql用什么中件间或插件好呢?
ASP.NET CORE写一个缓存Attribute工具
Ardunio - ULN2003 drive board and DC motor fan - control fan speed
Construction and test of hfish honey pot
pbootcms模板调用标签序数从2开始或者自动数开始