【问题标题】:Install electron on ubuntu在 ubuntu 上安装电子
【发布时间】:2015-09-18 16:33:50
【问题描述】:

当我尝试使用

在 Ubuntu 15.04 上安装电子时

sudo npm install electron-prebuilt -g

这就是我得到的

/usr/local/bin/electron -> /usr/local/lib/node_modules/electron-prebuilt/cli.js

> electron-prebuilt@0.28.3 postinstall /usr/local/lib/node_modules/electron-prebuilt
> node install.js

Downloading electron-v0.28.3-linux-x64.zip
Error: tunneling socket could not be established, cause=139936635598656:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:795:


/usr/local/lib/node_modules/electron-prebuilt/install.js:15
  throw err
        ^
Error: tunneling socket could not be established, cause=139936635598656:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:795:

npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! electron-prebuilt@0.28.3 postinstall: `node install.js`
npm ERR! Exit status 8
npm ERR! 
npm ERR! Failed at the electron-prebuilt@0.28.3 postinstall script.
npm ERR! This is most likely a problem with the electron-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls electron-prebuilt
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.19.0-18-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "electron-prebuilt"
npm ERR! cwd /usr/bin
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /usr/bin/npm-debug.log
npm ERR! not ok code 0

我试过了

使用以下命令为节点创建系统链接: ln -s node nodejs/usr/bin/ 文件夹中

安装 node-legacy 包:sudo apt-get install node-legacy 按照建议here 没有运气。

在其他论坛上找不到更多内容。所以请帮忙。 提前致谢。

【问题讨论】:

    标签: node.js ubuntu electron


    【解决方案1】:

    以下步骤对我有用: (假设 node 和 npm 已经安装)

    1. 将 npm 包更新到最新版本:-

      sudo npm install npm@latest -g

    2. 安装有以下开关的电子:

      sudo npm install electron -g --verbose --unsafe-perm=true --allow-root

    欢迎有经验的人提出更正/建议。希望对某人有所帮助。

    【讨论】:

    • 唯一对我有用的答案(有 ELIFECYCLE 错误)。谢谢!
    【解决方案2】:

    使用:

    ELECTRON_MIRROR=https://npm.taobao.org/mirrors/electron/ npm install

    【讨论】:

      【解决方案3】:

      您很可能在代理之后。

      您可以禁用它或让 npm install 在代理后面工作(请参阅this 问题)。

      【讨论】:

      • 是的,我确实在代理后面,但我已经设置了所有这些配置,其他应用程序也可以通过 npm 正常安装。
      • 假设您已按照上述帖子中的说明进行操作并且它不起作用 - 您可以禁用此代理吗?附言我刚刚在 ubuntu 的新副本上安装了 electron-prebuild,只需按照您的描述安装 node、npm 并将 nodejs 链接到 node。所以我很确定这仍然是代理问题。
      • 我的网络是由我的研究所通过代理服务器提供的。所以我无法禁用它。我必须从代​​理本身后面计算出它需要的任何东西。您还认为代理对不同应用程序的影响不同吗?因为正如我所提到的,我尝试执行其他模块的安装,并且它没有错误或警告
      • 从您的输出看来,ssl 仍然存在问题 - 可能是因为 electron-download 在下载 electron-prebuild 时使用了它。您可以尝试像这样从 http 镜像下载电子:set ELECTRON_MIRROR=npm.taobao.org/mirrors/electron && npm install electron-prebuild
      • electron-prebuilt 还运行一个从 aws 获取二进制文件的脚本。你可能想看看这个:github.com/mafintosh/electron-prebuilt/issues/21
      【解决方案4】:

      你打错了 安装 nodejs-legacy

      sudo apt-get install nodejs-legacy
      

      修复它,然后继续安装电子

      sudo npm install electron-prebuilt -g
      

      【讨论】:

        【解决方案5】:
        sudo npm install electron -g
        

        这对我有用

        【讨论】:

          【解决方案6】:

          首先安装最新版本的nodenpm by

          $ curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
          $ sudo apt-get install -y nodejs
          

          最新的npm version 现在是6.9.0,检查npm versionnpm --version 如果npm version6.4.1 只需先更新npm by

          $ npm install -g npm
          

          如果你有sudo引起的权限问题,那么你可以cd变成.npm-global

          $ cd /home/user_home_directory/.npm-global/
          

          使用chmod命令更改此文件夹中所有文件和目录的权限:

          $ sudo chmod 777 * -R
          

          安装后你必须将此行添加到.bashrc文件的末尾:

          export PATH="/home/user_home_directory/.npm-global/bin:$PATH"
          

          保存 .bashrc 后只需 source 即可

          $ source .bashrc
          

          全部完成后,可以通过

          全局安装electron
          $ npm install -g electron
          

          【讨论】:

            【解决方案7】:

            我到达这里是因为我的最终应用程序没有安装在 ubuntu 上。 如果有人遇到同样的问题,请转到构建位置并使用以下命令从终端运行: sudo dpkg -i <name of your install/build file> p.s.我没有在其他任何地方找到这个解决方案,这就是我在这里发布它的原因

            【讨论】:

              【解决方案8】:

              使用它可以帮助我:

              sudo npm install electron -g  --unsafe-perm=true --allow-root
              

              没有--unsafe-perm=true --allow-root 我收到这样的错误消息:

              > electron@10.1.5 postinstall /usr/local/lib/node_modules/electron
              > node install.js
              
              Error: EACCES: permission denied, mkdtemp 
              '/usr/local/lib/node_modules/electron/electron-download-rSlUcU'
              npm ERR! code ELIFECYCLE
              npm ERR! errno 1
              npm ERR! electron@10.1.5 postinstall: `node install.js`
              npm ERR! Exit status 1
              npm ERR! 
              npm ERR! Failed at the electron@10.1.5 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!     /root/.npm/_logs/2020-11-13T04_43_27_809Z-debug.log
              

              【讨论】:

                猜你喜欢
                • 2018-07-13
                • 1970-01-01
                • 1970-01-01
                • 2016-12-01
                • 2018-06-17
                • 2012-01-14
                • 2011-06-11
                • 2015-12-20
                • 2013-04-24
                相关资源
                最近更新 更多