Reputation: 46890
Attempting to resolve this question and getting the following error when installing electron globally with NPM:
ole@mki:~/angular-electron$ sudo npm install electron -g
/usr/bin/electron -> /usr/lib/node_modules/electron/cli.js
> [email protected] postinstall /usr/lib/node_modules/electron
> node install.js
/usr/lib/node_modules/electron/install.js:48
throw err
^
Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/electron/dist'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ole/.npm/_logs/2018-02-03T03_28_15_952Z-debug.log
Upvotes: 0
Views: 1455
Reputation: 2819
As npm proposes:
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
source ~/.profile
By doing it this was you keep your global npm packages scoped within your user account, instead of shared between all the users in the computer. Even if you're the only user, this is a recommended behavior. :-)
Upvotes: 4