weex学习 创建打包第一个weex项目 web和iOS的步骤

官方版本https://weex.apache.org/zh/guide/develop/create-a-new-app.html#初始化

感觉讲的还是比较清楚的。

这里总结一下集成遇到的问题。

 

创建一个新项目流程

cd 到目录

weex create my-project

cd my-project

npm install

有个警告(babel-loader@6.4.1 requires a peer of webpack@1 || 2 || ^2.1.0-beta || ^2.2.0-rc but none is installed. You must install peer dependencies yourself.)可忽略

npm start

如果报这个错误(npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! testweex1@1.0.0 serve: `webpack-dev-server --env.NODE_ENV=development --progress` npm ERR! Exit status 1)

端口号被占用、重启终端即可。

网上查了关闭终端方法(https://blog.csdn.net/mingzznet/article/details/38345875

先lsof -i:8080查找到端口号

lsof -i:8080

然后kill -9 15521

kill -9 15521

实际上我关闭了终端重启后就可以了。

 

打包成web

执行npm run pack:web就会有一个release文件夹,里面的html打开即可。

npm run pack:web

记录下运行完给的执行说明

包括其他平台,ios,安卓,web

Inside that directory, you can run several commands:


  npm start
  Starts the development server for you to preview your weex page on browser
  You can also scan the QR code using weex playground to preview weex page on native

  npm run dev
  Open the code compilation task in watch mode

  npm run ios
  (Mac only, requires Xcode)
  Starts the development server and loads your app in an iOS simulator

  npm run android
  (Requires Android build tools)
  Starts the development server and loads your app on a connected Android device or emulator

  npm run pack:ios
  (Mac only, requires Xcode)
  Packaging ios project into ipa package

  npm run pack:android
  (Requires Android build tools)
  Packaging android project into apk package

  npm run pack:web
  Packaging html5 project into `web/build` folder

  npm run test
  Starts the test runner

To get started:

  cd my-project
  npm start

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值