Windows环境下npm install 报错: operation not permitted, rename的解决方法

网络编程 发布日期:2024/10/3 浏览次数:1

正在浏览:Windows环境下npm install 报错: operation not permitted, rename的解决方法

前言

最近发现了一个问题,运行 npm install 命令安装依赖包,在 Mac 上的 Vagrant 装的虚拟机上没问题,在阿里云 CentOS 上也没问题,但是在 Windows 环境同样是 Vagrant 装的环境相同的虚拟机上就是不成功,报错如下:

npm ERR! Error: EPERM: operation not permitted, rename ‘/usr/share/nginx/html/tanteng.me/node_modules/duplexify' -> ‘/usr/share/nginx/html/tanteng.me/node_modules/.duplexify.DELETE'

Windows环境下npm install 报错: operation not permitted, rename的解决方法

之前遇到过 Windows 上 npm 安装依赖出现 symbol 的错误,解决方法是 sudo npm install –no-bin-links,加后面的参数即可。

列出 Node.js 的安装目录,目录的权限属性如图:

Windows环境下npm install 报错: operation not permitted, rename的解决方法

这里执行命令:

sudo chown vagrant:vagrant n node npm

记住还要清除 npm 缓存:

npm cache clean

再次执行 sudo npm install –no-bin-links,Windows 环境下即使是在虚拟机也需要带上后面的参数。

好了,这个时候问题就解决。以上就是这篇文章的全部内容了,希望本文能对同样遇到这个问题朋友们有所帮助。

高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。