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

有個警告([email protected] 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! [email protected] 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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章