nvm 是nodejs的版本管理器,相似 Anaconda(python的版本管理器)html
#預備工做 sudo apt-get update sudo apt-get install build-essential libssl-dev #獲取腳本並安裝 #方法一 curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash #方法二 wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash #更換源爲淘寶鏡像 #方法一(臨時) NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node #方法二(永久) #在 ~/.bashrc 中添加下列語句 export NVM_NODEJS_ORG_MIRROR=https://npm.taobao.org/mirrors/node
直接使用nvm進行node安裝和版本控制node
Webviz項目暫時僅支持 node10 和 node11,高版本的 node 會出現編譯錯誤。python
#查看可安裝的node版本 nvm ls-remote #安裝指定版本的node nvm install 10.19.0 #查看當前的node版本 nvm current #查看已安裝的node版本 nvm list #選擇須要的node版本 nvm use 10.19.0
在國內使用node的npm工具來安裝依賴包經常失敗,可能是網絡的問題git
#更換npm源爲淘寶的源 npm config set registry https://registry.npm.taobao.org #檢查是否配置成功 npm config get registry
#運行下面的命令能夠恢復成官方的源 npm config set registry https://registry.npmjs.org
若是在本地構建時出現下載chromium過慢,能夠嘗試如下操做github
npm config set puppeteer_download_host=https://npm.taobao.org/mirrors
更多本地構建的操做請看項目READMEweb
git clone https://github.com/cruise-automation/webviz.git cd webviz/
#建議先手動安裝node-sass npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/ npm install node-sass #執行腳本安裝項目依賴 npm run bootstrap
npm run build
npm run docs