Linux版本 Ubuntu 12.04 (32bit) 安裝Git 生成ssh key 安裝node 使用二進位文件 錯誤一:./node: cannot execute binary file 原因可能如下: 1、非root用戶或者無執行許可權 2、編譯環境不同(程式由其他操作環境複製過來) PS ...
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
錯誤四: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 (方法一)
錯誤二: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都會報錯的。