MAC 下node.js初体验 开发环境搭建

1、安装Xcode

https://developer.apple.com/xcode/

搜索官网下载并安装Xcode。

2、安装Homebrew

安装homebrew是为了便于安装后续需要的程序软件

a、进入主页https://brew.sh/index_zh-cn.html

b、复制homebrew主页的安装代码到终端中进行安装

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

c、在终端中输入brew -v 如果安装成功则会显示homebrew的版本信息

3、安装nodejs

a、在终端输入 brew install nodejs

b、安装成功后输入 node -v 查看版本信息

4、安装mongodb

a、在终端输入 brew install mongodb

b、安装成功后输入 mongo -version查看版本信息

5、安装redis

 a、在终端输入brew install redis

b、安装成功后输入 redis-cli -v查看版本信息

6、测试终端node.js

a、在终端输入 vi test.js

b、输入console.log('hello nodejs')

c、在终端输入 node test.js

终端会输出hello nodejs

 

posted @ 2017-06-10 23:31  龙骑士baby  阅读(1371)  评论(0编辑  收藏  举报