Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Electron 遇到的问题 #23

Open
yizihan opened this issue Apr 12, 2018 · 0 comments
Open

Electron 遇到的问题 #23

yizihan opened this issue Apr 12, 2018 · 0 comments
Labels

Comments

@yizihan
Copy link
Owner

yizihan commented Apr 12, 2018

安装

安装快速启动应用程序时,“permission denied, mkdir ...”

guosk-iMac:learn-electron guosk$ cd electron-quick-start/
guosk-iMac:electron-quick-start guosk$ sudo npm install && npm start
Password:

> [email protected] postinstall /Users/guosk/yizihan/learn-electron/electron-quick-start/node_modules/electron
> node install.js

/Users/guosk/yizihan/learn-electron/electron-quick-start/node_modules/electron/install.js:47
  throw err
  ^

Error: EACCES: permission denied, mkdir '/Users/guosk/yizihan/learn-electron/electron-quick-start/node_modules/electron/electron-tmp-download-533-1523497854045'

查看目录权限

bogon:electron-quick-start guosk$ ls -l
total 56
-rw-rw-r--  1 guosk  staff  6546  4 11 21:31 LICENSE.md
-rw-rw-r--  1 guosk  staff  2317  4 11 21:31 README.md
-rw-rw-r--  1 guosk  staff   584  4 11 21:31 index.html
-rw-rw-r--  1 guosk  staff  1925  4 11 21:31 main.js
drwxrwxr-x+ 6 root   staff   204  4 12 09:55 node_modules
-rw-rw-r--  1 guosk  staff   434  4 11 21:31 package.json
-rw-rw-r--  1 guosk  staff   171  4 11 21:31 renderer.js

更改安装命令

sudo npm install --unsafe-perm=true --allow-root
# —unsafe-perm:默认为false,如果为true则使用root用户安装,默认为非root用户安装
# —allow-root: 允许root

安装成功后的目录权限

guosk-iMac:electron-quick-start guosk$ ls -l
total 144
-rw-r--r--    1 guosk  staff   6546  4 12 11:17 LICENSE.md
-rw-r--r--    1 guosk  staff   2317  4 12 11:17 README.md
-rw-r--r--    1 guosk  staff    584  4 12 11:17 index.html
-rw-r--r--    1 guosk  staff   1925  4 12 11:17 main.js
drwxr-xr-x  151 root   staff   5134  4 12 11:18 node_modules
-rw-r--r--    1 root   staff  42924  4 12 11:18 package-lock.json
-rw-r--r--    1 guosk  staff    434  4 12 11:17 package.json
-rw-r--r--    1 guosk  staff    171  4 12 11:17 renderer.js

参考连接:安装electron,与安装失败问题的解决方案


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant