npm error Error: EPERM: operation not permitted, mkdir ‘C:\‘ npm error at async mkdir 的解决

使用npm安装全局模块时提示出现这个错误:

npm error Error: EPERM: operation not permitted, mkdir 'C:\' npm error     at async mkdir (node:internal/fs/promises:857:10) npm error     at async Arborist.reify

...

尝试了其他博主的方法,

比如:使用命令清除npm的缓存:npm cache clean --force

再比如:删除npmrc文件

又比如:重新配置环境变量

...

但是无一例外,都不行。

正当你我手足无措之际,

诶!会不会是终端的路径错了呢

这里以WebStorm为例,右键点击所要安装全局模块的文件夹(注意一定要最底层文件夹,并包含所有必要文件、项目),选择open in ,在此处打开终端,重新输入安装命令,静候成功。

由于本人刚刚接触前端开发,是小白中的小白。

这篇文章只是我个人在遇到该问题并成功解决后,觉得可能会对和我一样的新手有所帮助,故而发文分享。

很多地方表述错误或没表述明白,抑或是有些术语使用不当,尽请谅解,并欢迎各位指正。

npm error code EPERM npm error syscall mkdir npm error path D:\LenovoSoftstore\Install\Node\node_cache\_cacache npm error errno EPERM npm error FetchError: Invalid response body while trying to fetch https://registry.npmjs.org/hardhat: EPERM: operation not permitted, mkdir 'D:\LenovoSoftstore\Install\Node\node_cache\_cacache' npm error at D:\LenovoSoftstore\Install\Node\node_modules\npm\node_modules\minipass-fetch\lib\body.js:170:15 npm error at async Response.json (D:\LenovoSoftstore\Install\Node\node_modules\npm\node_modules\minipass-fetch\lib\body.js:75:17) npm error at async RegistryFetcher.packument (D:\LenovoSoftstore\Install\Node\node_modules\npm\node_modules\pacote\lib\registry.js:98:25) npm error at async RegistryFetcher.manifest (D:\LenovoSoftstore\Install\Node\node_modules\npm\node_modules\pacote\lib\registry.js:128:23) npm error at async getManifest (D:\LenovoSoftstore\Install\Node\node_modules\npm\node_modules\libnpmexec\lib\index.js:27:22) npm error at async missingFromTree (D:\LenovoSoftstore\Install\Node\node_modules\npm\node_modules\libnpmexec\lib\index.js:60:22) npm error at async D:\LenovoSoftstore\Install\Node\node_modules\npm\node_modules\libnpmexec\lib\index.js:182:32 npm error at async Promise.all (index 0) npm error at async exec (D:\LenovoSoftstore\Install\Node\node_modules\npm\node_modules\libnpmexec\lib\index.js:180:3) npm error at async Npm.exec (D:\LenovoSoftstore\Install\Node\node_modules\npm\lib\npm.js:207:9) { npm error code: 'EPERM', npm error errno: 'EPERM', npm error syscall: 'mkdir', npm error path: 'D:\\LenovoSoftstore\\Install\\Node\\node_cache\\_cacache', npm error type: 'system' npm error } npm error npm error The operation was rejected by your operating system. npm error It's possible that the file was already in use (by a text editor or antivirus), npm error or that you lack permissions to access it. npm error npm error If you believe this might be a permissions issue, please
03-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值