Node.js部署:
- 下載安裝包:
從Node.js官網(wǎng)下載Node.js安裝包塞椎。 - 安裝Node.js:
打開node-v6.9.4.pkg文件暖侨,一步步安裝即可启上。
linux環(huán)境下node-v6.9.4.tar.gz包安裝:
tar -zxvf node-v6.9.4.tar.gz
cd node-v6.9.4
./configure
make
sudo make install
AngularJS2部署:
- 全局安裝yo:
yangweidandeMacBook-Pro:~ zhaoxueyong$ node -v
v6.9.4
yangweidandeMacBook-Pro:~ zhaoxueyong$ npm -v
3.10.10
yangweidandeMacBook-Pro:~ zhaoxueyong$ sudo npm install -g yo
- 全局安裝generator:
yangweidandeMacBook-Pro:Browser zhaoxueyong$ sudo npm install -g generator-karma
npm ERR! shasum check failed for /tmp/npm-17960-7f712c1b/registry.npmjs.org/istextorbinary/-/istextorbinary-2.1.0.tgz
npm ERR! Expected: dbed2a6f51be2f7475b68f89465811141b758874
npm ERR! Actual: 6a2b96fd6b0894eb0e63405d2a97cab7cbc65926
npm ERR! From: https://registry.npmjs.org/istextorbinary/-/istextorbinary-2.1.0.tgz
#解決方法參考“參考資料[5]”
yangweidandeMacBook-Pro:Browser zhaoxueyong$ sudo npm install -g grunt-cli bower yo generator-karma generator-angular #必須同時安裝才能成功,很神奇
yangweidandeMacBook-Pro:ColusLifeDemo zhaoxueyong$ sudo npm install phantomjs -g
phantomjs安裝失敗媒吗,個人遇到的原因是默認安裝包地址被墻辈毯,更換成可用地址即可坝疼。
npm install phantomjs-prebuilt --phantomjs_cdnurl=http://cnpmjs.org/downloads
- 構建前臺框架:
yangweidandeMacBook-Pro:ColusLifeDemo zhaoxueyong$ cd Browser/
yangweidandeMacBook-Pro:ColusLifeDemo zhaoxueyong$ sudo yo angular
- 啟動服務:
yangweidandeMacBook-Pro:Browser zhaoxueyong$ cat Gruntfile.js
yangweidandeMacBook-Pro:Browser zhaoxueyong$ grunt serve
# 啟動已經(jīng)存在的項目之前,需要在項目目錄下執(zhí)行npm install && bower install
Bootstrap部署(不需要):
yangweidandeMacBook-Pro:bootstrap-3.3.7-dist zhaoxueyong$ tree
.
├── css
│ ├── bootstrap-theme.css
│ ├── bootstrap-theme.css.map
│ ├── bootstrap-theme.min.css
│ ├── bootstrap-theme.min.css.map
│ ├── bootstrap.css
│ ├── bootstrap.css.map
│ ├── bootstrap.min.css
│ └── bootstrap.min.css.map
├── fonts
│ ├── glyphicons-halflings-regular.eot
│ ├── glyphicons-halflings-regular.svg
│ ├── glyphicons-halflings-regular.ttf
│ ├── glyphicons-halflings-regular.woff
│ └── glyphicons-halflings-regular.woff2
└── js
├── bootstrap.js
├── bootstrap.min.js
└── npm.js
- 把編譯包放到庫目錄:
yangweidandeMacBook-Pro:lib zhaoxueyong$ mv bootstrap-3.3.7-dist/ /usr/local/lib/
yangweidandeMacBook-Pro:lib zhaoxueyong$ cd /usr/local/lib/
yangweidandeMacBook-Pro:~ zhaoxueyong$ mv bootstrap-3.3.7-dist/ bootstrap
- 問題解決:
啟動時提示如下告警:
Warning: not found: compass Used --force, continuing.
應該是沒有安裝Ruby導致的谆沃,安裝Ruby再嘗試嘗試钝凶。