linux+npm+v+报错_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、编译环境不同(程序由其他操作环境复制过来)

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

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

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

编译源码

错误一: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

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

建立软连接:

sudo ln -s /home/lufeng/Documents/node-v8.16.0-linux-x86/bin/node /usr/local/binsudo ln -s /home/lufeng/Documents/node-v8.16.0-linux-x86/bin/npm /usr/local/binsudo 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

sudo add-apt-repository ppa:ubuntu-toolchain-r/testsudo apt-get updatesudo 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

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

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值