开篇说几句,网上让用homebrew安装nodejs的都是坑人的。我踩坑无数。特此记录。

只需以下几行代码

sudo apt-get update

# 安装系统依赖
sudo apt-get install build-essential git openssl

# 安装 nodes
curl -sL https://deb.nodesource.com/setup_5.x | sudo -E bash -
sudo apt-get install nodejs 

# 修复 npm 全局安装的文件权限问题
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'

# 设置 Bash 环境变量
echo [[ -s "$HOME/.profile" ]] && source $HOME/.profile' >> ~/.bash_profile
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.profile
source ~/.profile

# 安装 testrpc
npm install -g ethereumjs-testrpc

# 安装 truffle
npm install -g truffle

欢迎留言