如何实现Mac内通过brew安装指定版本nodejs

php中世界最好的语言
php中世界最好的语言 原创
2018-05-29 10:33:21 2832浏览

这次给大家带来如何实现Mac内通过brew安装指定版本nodejs,Mac内通过brew安装指定版本nodejs的注意事项有哪些,下面就是实战案例,一起来看一下。

一、安装brew

终端上运行 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

二、安装nodejs

运行brew install node 即可,但是这样安装的node是最新node,本人安装后是node6.X,node6.X对一些就模块已经不支持了,比如graceful-fs,导致安装一些包的时候,无法运行,就会出现类似 (node:7844) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version 的提示。

三、安装指定版本的node

旧版的brew,可以通过brew versions nodejs,运行后会提示 Error: The `versions` command is no longer supported. brew versions已废弃掉了。

1、需要安装homebrew-version

brew tap homebrew/versions

2、查看可安装的node版本

brew install homebrew/versions/node

3、选择按一个node的版本

brew install homebrew/versions/node5

这样就可以成功安装node5.x版本

相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

推荐阅读:

如何处理Mac安装thrift因bison报错

如何使用淘宝镜像cnpm安装Vue.js

以上就是如何实现Mac内通过brew安装指定版本nodejs的详细内容,更多请关注php中文网其它相关文章!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。