Webviz - ROS可視化開源項目 - 本地構建教程

1. 安裝 nvm

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

2. 安裝nodejs

直接使用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

3. 換源加速

在國內使用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

4. 本地構建

更多本地構建的操做請看項目READMEweb

  1. 克隆項目到本地
    git clone https://github.com/cruise-automation/webviz.git
    cd webviz/
  2. 安裝依賴
    #建議先手動安裝node-sass
    npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
    npm install node-sass
    #執行腳本安裝項目依賴
    npm run bootstrap
    img
  3. 編譯項目
    npm run build
    img
    img
  4. 運行項目
    npm run docs
    img

5. 運行視頻

相關文章
相關標籤/搜索