Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/30.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 使用NPM在Ubuntu上全局安装electron_Node.js_Angular_Ubuntu_Npm_Electron - Fatal编程技术网

Node.js 使用NPM在Ubuntu上全局安装electron

Node.js 使用NPM在Ubuntu上全局安装electron,node.js,angular,ubuntu,npm,electron,Node.js,Angular,Ubuntu,Npm,Electron,在使用NPM全局安装electron时,尝试解决并获取以下错误: ole@mki:~/angular-electron$ sudo npm install electron -g /usr/bin/electron -> /usr/lib/node_modules/electron/cli.js > electron@1.7.12 postinstall /usr/lib/node_modules/electron > node instal

在使用NPM全局安装electron时,尝试解决并获取以下错误:

    ole@mki:~/angular-electron$ sudo npm install electron -g 
    /usr/bin/electron -> /usr/lib/node_modules/electron/cli.js

    > electron@1.7.12 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! electron@1.7.12 postinstall: `node install.js`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the electron@1.7.12 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
作为:

通过这样做,您可以在您的用户帐户内保持您的全局npm包的范围,而不是在计算机中的所有用户之间共享。即使您是唯一的用户,这也是推荐的行为。:-)

作为:


通过这样做,您可以在您的用户帐户内保持您的全局npm包的范围,而不是在计算机中的所有用户之间共享。即使您是唯一的用户,这也是推荐的行为。:-)

你试过sudo-pmkdir/usr/lib/node\u modules/electron吗?我试过了。然后它抱怨…electron/dist目录。。。。如果我创造了它仍然抱怨它不能创造它。似乎electron并不是为全球安装而设计的……我写了一篇关于如何绕过这个问题并在全球安装electron的小指南:@donnikitos-Thx。你的简单解决方案有效。你试过sudo-pmkdir/usr/lib/node_modules/electron吗?我试过了。然后它抱怨…electron/dist目录。。。。如果我创造了它仍然抱怨它不能创造它。似乎electron并不是为全球安装而设计的……我写了一篇关于如何绕过这个问题并在全球安装electron的小指南:@donnikitos-Thx。你的简单解决方案有效。太棒了!这将有助于很多其他事情。顺便说一句,我们能够解决电子使用本地安装如下所示:太好了!这将有助于许多其他事情。顺便说一句,我们能够使用本地安装解析electron,如下所示:
 mkdir ~/.npm-global
 npm config set prefix '~/.npm-global'
 export PATH=~/.npm-global/bin:$PATH
 source ~/.profile