Node.js笔记

问: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**文件。添加镜像地址。

bash 复制代码
registry=https://registry.npmmirror.com
ELECTRON_MIRROR="https://npmmirror.com/mirrors/electron/"
bash 复制代码
npm config set registry https://registry.npm.taobao.org

2、执行这两个命令

bash 复制代码
npm config set registry https://registry.npmmirror.com
bash 复制代码
npm install --save-dev electron --registry https://registry.npmmirror.com/   
复制代码
npm install -g yarn
yarn add --dev electron

yarn start

yarn add electron-builder --dev
yarn build

【electron】5分钟把网页打包成可安装的exe桌面应用

IP查询

我的关联笔记

使用yarn,如何编译打包electron?

相关推荐
-凌凌漆-15 分钟前
【npm】npm的-D选项介绍
前端·npm·node.js
lucky670722 分钟前
Windows 上彻底卸载 Node.js
windows·node.js
鹿心肺语37 分钟前
前端HTML转PDF的两种主流方案深度解析
前端·javascript
深蓝海拓1 小时前
PySide6,QCoreApplication::aboutToQuit与QtQore.qAddPostRoutine:退出前后的清理工作
笔记·python·qt·学习·pyqt
酒鼎1 小时前
学习笔记(3)HTML5新特性(第2章)
笔记·学习·html5
一个懒人懒人1 小时前
Promise async/await与fetch的概念
前端·javascript·html
山岚的运维笔记2 小时前
SQL Server笔记 -- 第20章:TRY/CATCH
java·数据库·笔记·sql·microsoft·sqlserver
Gain_chance2 小时前
33-学习笔记尚硅谷数仓搭建-DWS层交易域用户粒度订单表分析及设计代码
数据库·数据仓库·hive·笔记·学习·datagrip
Android系统攻城狮2 小时前
鸿蒙系统Openharmony5.1.0系统之解决编译时:Node.js版本不匹配问题(二)
node.js·鸿蒙系统·openharmony·编译问题·5.1
承渊政道2 小时前
Linux系统学习【Linux系统的进度条实现、版本控制器git和调试器gdb介绍】
linux·开发语言·笔记·git·学习·gitee