Mac 配置前端基本环境

时间:2022-07-01 03:28:56

一,sublime
下载一个版本,替换packages,要想shift  command p管用,得在sublime里面control ~,然后把
import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)
复制到sublime下部。
 
cd /Users/liheyao/Library/Application\ Support/Sublime\ Text\ 3/
open ./
JsFormart: ctrl+alt+F 格式化js
CssComb: ctrl +shift + c格式化css(依赖node) 
 
二,nvm 
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.3/install.sh | bash
vim ~/.bash_profile
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm

  

关掉终端重新打开,nvm ls-remote(查看)
 nvm install v5.10.1
nvm use v5.10.1
nam install cnpm

  

 
三,git
ssh-keygen 一直回车
ls ~/.ssh
open ~/.ssh
 
 
四,sass
由于自带ruby,可直接安装
 
sudo gem install sass

  

五,webpack
需要全局和项目根目录安装
nam install webpack 
webpack-dev-server也需要全局和项目根目录安装
 
六  grunt
需要全局和项目根目录安装 
npm install grunt

  

七 nginx
安装brew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装nginx
 brew install nginx
打开nginx路径:
open /usr/local/etc/nginx  
打开:
sudo  /usr/local/bin/nginx

重启:

sudo  /usr/local/bin/nginx -s reload
//或者
sudo /usr/local/bin/nginx -s stop && sudo /usr/local/bin/nginx
八 mongoldb
     更新brew: 
brew update
       安装mongodb:
brew install mongodb 
       启动: 
mongod 
    再打开:
mongo