OS X 开发环境配置:homebrew + yarn + nvm

发布时间:2019-07-16 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了OS X 开发环境配置:homebrew + yarn + nvm脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

问题

brew install yarn --without-node 不再起作用,yarn 已经删除了 option --without-node

准备

homebrew 已安装。
(非必需条件)使用 zsh 替换 bash:

chsh -s /bin/zsh

安装步骤

  1. 安装 nvm:

    1. 确定 ~/.bash_profile 是否存在,如果没有则新建一个;执行 touch ~/.bash_profile
    2. 执行安装命令:

      // 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:

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

        node -v

        显示 node 版本,例如 v12.1.0

  2. 安装 yarn:

    1. 安装 yarn 时不安装 node:

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

      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 信息消失。

脚本宝典总结

以上是脚本宝典为你收集整理的OS X 开发环境配置:homebrew + yarn + nvm全部内容,希望文章能够帮你解决OS X 开发环境配置:homebrew + yarn + nvm所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: