• Electron npm install 常见错误(Linux)


    Linux版本

    Ubuntu 12.04 (32bit)

    安装Git

    sudo apt-get install git

    生成ssh key

    #查看有没有sshkey
    cd ~/.ssh
    #生成
    ssh-keygen
    #查询
    cat ~/.ssh/id_rsa.pub

    安装node

    使用二进制文件

    错误一:./node: cannot execute binary file

    原因可能如下:

    1、非root用户或者无执行权限

    2、编译环境不同(程序由其他操作环境复制过来)

    PS:https://blog.51cto.com/1381479/888198

    错误二:axconfig: port 1 not active axconfig: port 2 not active

    原因:可能 sudo apt-get install node 这么去安装node了。

    解决:先 sudo apt-get remove node 卸载掉,从node官网下。

    PS:https://dolinux.blogspot.com/2012/04/axconfig-port-1-not-active-axconfig.html

    编译源码

    错误一:WARNING: failed to autodetect C++ compiler version (CXX=g++)

    ERROR: Did not find a new enough assembler, install one or build with

           --openssl-no-asm.

           Please refer to BUILDING.md

    PS:因为安装过程复制且不顺利,就不走这条路。

    低版本的node

    https://nodejs.org/download/release/latest-v8.x/

    PS:Node 10.10以上版本,Ubuntu 12.04一直无法正常使用,所以我用了8版本。

    安装步骤:https://www.cnblogs.com/zhuawang/p/7617176.html

    建立软连接:

    sudo ln -s /home/lufeng/Documents/node-v8.16.0-linux-x86/bin/node /usr/local/bin
    sudo ln -s /home/lufeng/Documents/node-v8.16.0-linux-x86/bin/npm /usr/local/bin
    sudo ln -s /home/lufeng/Documents/node-v8.16.0-linux-x86/bin/node-gyp /usr/local/bin

    electron npm install

    错误一: ../../../nan/nan.h:50:3: error: #error This version of node/NAN/v8 requires a C++11 compiler

    解决:http://mortenvp.com/installing-a-newer-gccg-on-ubuntu-12-04-lts/

    sudo add-apt-repository ppa:ubuntu-toolchain-r/test
    sudo apt-get update
    sudo apt-get install gcc-4.9 g++-4.9
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9

    错误二:make: cc: Command not found

    解决:

    sudo ln -s  /usr/bin/gcc-4.9 /usr/bin/cc

    错误三:/usr/bin/ld: cannot find -lcrypto

    下载一个libcrypto.so.6 文件

    sudo ln -s /home/lufeng/Documents/lib/libcrypto.so.6 /lib/libcrypto.so

    or 

    yum install openssl-devel

    错误四:error: 'memcpy' was not declared in this scope

    原因:node插件源码报错了,其实解决办法很容易,到程序中加上头文件string.h就好了,就是 #include<string.h>

    electron rebuild

    错误一:fatal error openssl/rand.h no such file or directory

    解决:安装libssl-dev。

    sudo apt-get install libssl-dev

    可能libssl-dev会安装失败

    sudo apt-get install libssl-dev=1.0.1-4ubuntu5

    解决:https://www.cnblogs.com/liushui-sky/p/9304495.html (方法一)

    or

    yum install -y openssl openssl-devel openssl-libs

    错误二:error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory

    解决:

    sudo apt-get install libxss1

    错误三:error while loading shared libraries: libatk-bridge-2.0.so.0: cannot open shared object file: No such file or directory

    暂时无解:一直install 不了libatk-bridge2.0-0这个依赖,总是报未找到匹配软件包!!!

    总结

    Electron rebuild到上面最后的一个错,就走不下去了,那个缺失的库始终无法安装,也就是Ubuntu 12.04 上运行Electron宣告失败。

    Ubuntu12.04 试了两天,太心累了,系统缺失的库太多了且有装不上的。

    最后,我更换Ubuntu16.04 做尝试,却很快成功跑起Electron。它仅仅缺失一个库,上面大部分错误都没有出现。不过要注意Node使用10版本、gcc使用4.9就行了,使用Node 12、gcc 5都会报错的。 

    其他Linux

    错误一:Need executable 'rpmbuild' to convert dir to rpm。

    解决:

    yum install rpm-build

    错误二:打开应用时,显示 segmentation fault。

    原因:打包appId重复了。

    错误三:没有go

    解决:

    sudo yum install golang
  • 相关阅读:
    移动终端app测试点总结
    Appium+Java(一) Windows环境搭建篇
    BeanShell用法汇总(部分摘抄至网络)【转】
    JVM的GC实现详解
    JVM的GC理论详解
    JVM的栈内存
    JVM的基本结构
    JVM的生命周期
    JVM的启动流程
    JVM的粗略简述
  • 原文地址:https://www.cnblogs.com/lovesong/p/11300175.html
Copyright © 2020-2023  润新知