怎么解决使用brew安装yarn后node环境报错问题-成都快上网建站

怎么解决使用brew安装yarn后node环境报错问题

本篇内容主要讲解“怎么解决使用brew安装yarn后node环境报错问题”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“怎么解决使用brew安装yarn后node环境报错问题”吧!

创新互联建站是一家专业提供绥宁企业网站建设,专注与网站建设、成都网站制作、H5网站设计、小程序制作等业务。10年已为绥宁众多企业、政府机构等服务。创新互联专业网站设计公司优惠进行中。

使用brew 安装 yarn 之后 ,node环境报错

dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib
Referenced from: /usr/local/opt/node@8/bin/node
Reason: image not found

解决方法

brew list  # 查看安装的软件
brew uninstall --ignore-dependencies node icu4c  # 卸载软件
brew uninstall nvm  #卸载nvm
brew uninstall node[@8](https://my.oschina.net/u/147515)  #卸载node[@8](https://my.oschina.net/u/147515)
brew uninstall yarn   #卸载 yarn

安装软件
brew install nvm
==> Caveats
Please note that upstream has asked us to make explicit managing
nvm via Homebrew is unsupported by them and you should check any
problems against the standard nvm install method prior to reporting.

You should create NVM's working directory if it doesn't exist:

  mkdir ~/.nvm

Add the following to ~/.zshrc or your desired shell
configuration file:

  export NVM_DIR="$HOME/.nvm"
  [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
  [ -s "/usr/local/opt/nvm/etc/bash_completion" ] && . "/usr/local/opt/nvm/etc/bash_completion"  # This loads nvm bash_completion

You can set $NVM_DIR to any location, but leaving it unchanged from
/usr/local/opt/nvm will destroy any nvm-installed Node installations
upon upgrade/reinstall.

Type `nvm help` for further information.

Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
????  /usr/local/Cellar/nvm/0.34.0: 7 files, 141.7KB, built in 8 seconds
  • 根据提示,创建文件,配置参数

       mkdir ~/.nvm
    	Add the following to ~/.zshrc or your desired shell
      configuration file:
    
        export NVM_DIR="$HOME/.nvm"
        [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh"  # This loads nvm
        [ -s "/usr/local/opt/nvm/etc/bash_completion" ] && . "/usr/local/opt/nvm/etc/bash_completion"  # This loads nvm bash_completion

  • 再使用nvm 安装node

       ~ nvm list
      			N/A
      iojs -> N/A (default)
      node -> stable (-> N/A) (default)
      unstable -> N/A (default)
      nvm_list_aliases:36: no matches found: /Users/caonn/.nvm/alias/lts/*
      ➜  ~ nvm install v8.11.2
      Downloading and installing node v8.11.2...
      Downloading https://nodejs.org/dist/v8.11.2/node-v8.11.2-darwin-x64.tar.xz...
      ######################################################################## 100.0%
      Computing checksum with shasum -a 256
      Checksums matched!
      Now using node v8.11.2 (npm v5.6.0)
      Creating default alias: default -> v8.11.2
      ➜  ~ node -v
      v8.11.2
      ➜  ~ npm -v
      5.6.0
      ➜  ~

到此,相信大家对“怎么解决使用brew安装yarn后node环境报错问题”有了更深的了解,不妨来实际操作一番吧!这里是创新互联网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!


网站题目:怎么解决使用brew安装yarn后node环境报错问题
分享地址:http://kswjz.com/article/iheodg.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流