正常情况下我们安装了node.js会自带npm ,所以直接terminal输入指令就可以,如下三个步骤。
1, install node-v4.3.1-darwin-x64.tar
2,install mongoose
Open terminal run “ npm install mongoose ”.
3, Open terminal, go to project folder, run "mongoose" command
Mobiles-MacBook-Pro:~ Mobile$ cd 你项目的路径
Mobiles-MacBook-Pro:你项目的路径 Mobile$ mongoose
但是由于各种什么墙的问题,正常会出现找不到mongoose指令的提示,所以建议使用brew install mongoose指令,但是由于mac下面访问usr路径需要权限,所以建议你看清楚提示手动往对应的路径新建文件夹还有开启读写权限。
Mobiles-MacBook-Pro:~ Mobile$ brew install mongoose
==> Installing dependencies for mongoose: openssl
==> Installing mongoose dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2g.yosemite.bot
######################################################################## 100.0%
==> Pouring openssl-1.0.2g.yosemite.bottle.tar.gz
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl/certs
and run
/usr/local/opt/openssl/bin/c_rehash
This formula is keg-only, which means it was not symlinked into /usr/local.
Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/openssl/lib
CPPFLAGS: -I/usr/local/opt/openssl/include
==> Summary
? /usr/local/Cellar/openssl/1.0.2g: 1,678 files, 12.0M
==> Installing mongoose
==> Downloading https://homebrew.bintray.com/bottles/mongoose-5.6.yosemite.bottl
######################################################################## 100.0%
==> Pouring mongoose-5.6.yosemite.bottle.2.tar.gz
? /usr/local/Cellar/mongoose/5.6: 75 files, 371K
Mobiles-MacBook-Pro:~ Mobile$ pwd
/Users/Mobile
Mobiles-MacBook-Pro:~ Mobile$ mongoose
Mongoose web server v.5.6 serving [/Users/Mobile] on port 8080
mongoose^CExiting on signal 2 ... done.
Mobiles-MacBook-Pro:~ Mobile$ cd /你项目的路径
Mobiles-MacBook-Pro:你项目的路径 Mobile$ mongoose
Mongoose web server v.5.6 serving [/你项目的路径] on port 8080
出现8080,恭喜你成功了