標籤:radio use conflict script binary hive arch json http
文章最初發表於szhshp的第三邊境研究所
轉載請註明
Ubuntu 16.04 安裝NodeJS
天哪Linux安裝NodeJS居然也這麼麻煩
NodeJS安裝
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -sudo apt-get install -y nodejs
可能會出現找不到 curl的錯誤, apt-get一下curl就可以了
NPM安裝
curl http://npmjs.org/install.sh | sudo shsudo apt-get install curl
node VS nodeJS?
NPM, Node安裝成功後執行:
node -v
發現報錯
-bash: /usr/sbin/node: No such file or directory
但是可以使用
nodejs -v
這個問題的原因:
There is a naming conflict with the node package (Amateur Packet Radio Node Program), and the nodejs binary has been renamed from node to nodejs. You‘ll need to symlink /usr/bin/node to /usr/bin/nodejs or you could uninstall the Amateur Packet Radio Node Program to avoid that conflict.
當然直接用nodejs命令也可以執行node程式, 不過後續如果安裝modules就會出現node 未定義的錯誤
解決方案是添加一個link:
You need to manually create a symlink /usr/bin/node. Shortcut for bash compatible shells:
sudo ln -s `which nodejs` /usr/bin/node
Or if you use non-standard shells, just hardcode the path you find with which nodejs:
sudo ln -s /usr/bin/nodejs /usr/bin/node
NPM: Permission Denied
npm安裝Hexo出現問題:
node scripts/build_highlight_alias.js > highlight_alias.jsonsh: 1: cannot create highlight_alias.json: Permission denied
換成sudo依然報錯.
解決方案見官方Guide: https://docs.npmjs.com/getting-started/fixing-npm-permissions
參考文獻
- https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions
- http://www.cnblogs.com/seanlv/archive/2011/09/24/2189719.html
- https://stackoverflow.com/questions/18130164/nodejs-vs-node-on-ubuntu-12-04
- https://github.com/hexojs/hexo-util/issues/9
優雅地亂玩Linux-3-Ubuntu下NodeJS的安裝