npm install electron
npm ERR! code 1
npm ERR! path /Users/xiao/Desktop/electron-vite-vue/node_modules/electron
npm ERR! command failed
npm ERR! command sh -c node install.js
npm ERR! Error: EACCES: permission denied, mkdir '/Users/xiao/Library/Caches/electron/f8e03b2129990754e6cc23188df6e2ffadd2a89efe51212cc71cdb75565326c4'
解决方案
sudo npm install electron --unsafe-perm=true
参考地址https://github.com/electron/electron/blob/8a4c76d6558cffa53400e54317f0f9b1da22f7ef/docs/tutorial/installation.md#troubleshooting
文章描述了在尝试使用npm安装Electron时遇到EACCES错误,由于权限问题导致mkdir失败。提供了解决方案,即使用`sudonpminstallelectron--unsafe-perm=true`。参考链接提供了官方文档的相应troubleshooting部分。
1万+

被折叠的 条评论
为什么被折叠?



