OS X 開發環境配置:homebrew + yarn + nvm

問題

brew install yarn --without-node 再也不起做用,yarn 已經刪除了 option --without-nodenode

準備

homebrew 已安裝。
(非必需條件)使用 zsh 替換 bash:git

chsh -s /bin/zsh

安裝步驟

  1. 安裝 nvm:github

    1. 肯定 ~/.bash_profile 是否存在,若是沒有則新建一個;執行 touch ~/.bash_profile
    2. 執行安裝命令:shell

      // cURL:
      curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
      // or Wget:
      wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
    3. 安裝 node:npm

      // 安裝最新 node
      nvm install node --latest-npm
      // Always default to the latest available node version on a shell
      nvm alias default node
      1. 檢查 node:bash

        node -v

        顯示 node 版本,例如 v12.1.0curl

  2. 安裝 yarn:url

    1. 安裝 yarn 時不安裝 node:code

      brew install yarn --ignore-dependencies
    2. 查找 node:orm

      which node

      顯示 node 的安裝位置,例如:/Users/<your's-user-name>/.nvm/versions/node/v12.1.0/bin/node

    3. 執行 brew doctor 檢查依賴,會出現:

      Warning: Some installed formulae are missing dependencies.
      You should `brew install` the missing dependencies:
          brew install node
      
      Run `brew missing` for more details.
    4. 爲 homebrew 建立 node 的 symbol link:

      ln -s ~/.nvm/versions/ /usr/local/Cellar/node
    5. 再次執行 brew doctor 進行檢查,Warning 信息消失。
相關文章
相關標籤/搜索