问:npm install时,报错误:Failed to remove some directories。怎么办?
答:我在使用npm安装electron时总是报上面的错误,具体如下,我问遍了KIMI和通义,回答的方法都解决不了。还搜索了stackoverflow,国外的朋友也没有回答好的解决方法。经尝试,很明显不是表面报的权限问题。所以我换了思路,换一个工具安装。使用了electron官网介绍的,使用yarn工具安装,解决了这个问题。
npm warn cleanup Failed to remove some directories [
npm warn cleanup [
npm warn cleanup '\\\\?\\C:\\Users\\tianming.fan\\AppData\\Local\\npm-cache\\_npx\\1323dbbc85759269\\node_modules',
npm warn cleanup [Error: EPERM: operation not permitted, rmdir 'C:\Users\tianming.fan\AppData\Local\npm-cache\_npx\1323dbbc85759269\node_modules\@electron\get'] {
npm warn cleanup errno: -4048,
npm warn cleanup code: 'EPERM',
npm warn cleanup syscall: 'rmdir',
npm warn cleanup path: 'C:\\Users\\tianming.fan\\AppData\\Local\\npm-cache\\_npx\\1323dbbc85759269\\node_modules\\@electron\\get'
npm warn cleanup }
npm warn cleanup ]
npm warn cleanup ]
1、.npmrc文件
首先在C盘Users,你的登录的账号名文件夹下,编辑.npmrc文件。添加镜像地址。
registry=https://registry.npmmirror.com
ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/"
npm config set registry https://registry.npm.taobao.org
2、执行这两个命令
npm config set registry https://registry.npmmirror.com
npm install --save-dev electron --registry https://registry.npmmirror.com/
npm install -g yarn yarn add --dev electronyarn startyarn add electron-builder --dev yarn build
【electron】5分钟把网页打包成可安装的exe桌面应用
IP查询
我的关联笔记
使用yarn,如何编译打包electron?