安装
- 先安装node.js环境
- sudo npm install -g weex-toolkit
安装信息异常
- 异常:user "root" does not have permission to access the dev dir "/Users/iluoxuan/.node-gyp/0.12.0"
- 修复:sudo chmod -R 777 /Users/iluoxuan/.node-gyp
- 查看weex版本:weex -version
异常信息
function* promiseToGenerator(promise) {
^
SyntaxError: Unexpected token *
尝试升级node
- 这里需要全局安装:sudo npm install -g n
- 升级node.js到最新稳定版:sudo n stable
升级完成
git weex --version
info 0.4.2
创建weex工程
- mkdir weex-test
- cd weex-test
- weex init
prompt: Project Name: (weex-test)
file: .gitignore created.
file: README.md created.
file: index.html created.
file: package.json created.
file: src/main.we created.
file: webpack.config.js created.
```
* 安装依赖: sudo npm install
* 修改 package.json:
```
"dev": "webpack --watch & serve -p 12580"
```
* 运行:npm run dev
```
/Users/iluoxuan/git/weex-test on port 12580
```
* 访问localhost:12580 就可以看到hello weex