好友最近在学Angular2,刚完成一个feature,还提交到GIT上。我心下好奇,就准备玩一下他的这个小功能。谁知,卡在工程部署上。
部署过程#
clone项目到本地#
1 | git clone https://github.com/Frey-Fu/ng2-echarts.git |
阅读README.md#
This is ECharts for Angular2, code is in src/, there’s an example project in example/, feel free to use it. The example is based on angular2-webpack-starter.
How to use:#
1 | cd example |
安装typings#
查看官方手册:
https://www.npmjs.com/package/typings
Install Typings CLI utility.#
1 | npm install typings --global |
结果好像成功了:1
2
3
4
5
6typings@2.0.0 node_modules/typings
├── elegant-spinner@1.0.1
├── has-unicode@2.0.1
├── listify@1.0.0
...
...
测试Typings,报错#
1 | # Search for definitions. |
结果:
1 | /usr/local/lib/node_modules/typings/node_modules/typings-core/node_modules/strip-bom/index.js:2 |
Review typings的安装日志,发现一些警告#
我的node版本低于要求1
2
3
4
5
6...
npm http 304 https://registry.npm.taobao.org/is-utf8
npm WARN engine deep-extend@0.4.1: wanted: {"node":">=0.12.0","iojs":">=1.0.0"} (current: {"node":"v0.10.24","npm":"1.3.21"})
npm http GET https://registry.npm.taobao.org/wrappy
npm http GET
...
升级node#
http://theholmesoffice.com/node-js-fundamentals-how-to-upgrade-the-node-js-version/
1: Check your current version of Node.
1 | $node -v |
2: Clear your npm cache1
sudo npm cache clean -f
3: Install ‘n’1
sudo npm install -g n
4: Upgrade to a stable version1
sudo n stable
5: Check the running version of Node to verify that it has worked:1
$node -v v0.8.11
重装node#
参考1: http://linyehui.me/2016/03/03/reinstall-nodejs-on-osx.html
参考2: http://icarus4.logdown.com/posts/175092-nodejs-installation-guide
再安装#
1 |
|
编译运行#
1 | npm run build:prod |
服务启动成功,结果如下:
1 |
|