1. 程式人生 > >51.webpack vue-cli創建項目

51.webpack vue-cli創建項目

oba lan rate 說明 操作 follow 命令 with fail

在上兩篇博文中已經安裝了node.js、webpack、vue-cli,安裝的版本為:

技術分享圖片

今天通過這篇博文創建項目。

1.選擇路徑

首先通過命令行進入想要創建項目的路徑,例如:

通過e:命令進入盤幅,再經過cd命令進入文件夾。

2.創建項目

通過命令vue init webpack pm,其中pm為你創建項目的項目名稱,在執行命令後vue-cli會下載模板,之後進行項目信息設置:

  1. 設置項目名稱
  2. ? Project name pmtext
  3. 設置項目描述
  4. ? Project description intracompany
  5. 作者
  6. ? Author hys
  7. ? Vue build (Use arrow keys)
  8. ? Vue build standalone
  9. 設置路由
  10. ? Install vue-router? Yes
  11. ? Use ESLint to lint your code? No
  12. 單元測試
  13. ? Set up unit tests Yes
  14. ? Pick a test runner jest
  15. ? Setup e2e tests with Nightwatch? Yes
  16. ? Should we run `npm install` for you after the project has been created? (recom
  17. ? Should we run `npm install` for you after the project has been created? (recom
  18. ? Should we run `npm install` for you after the project has been created? (recom
  19. ? Should we run `npm install` for you after the project has been created? (recom
  20. mended) no (此處應該選擇no
  21. vue-cli · Generated "pmtext".
  22. # Project initialization finished!
  23. # ========================
  24. To get started:
  25. 提示下一步操作
  26. 進入pmtext文件夾
  27. cd pmtext
  28. 初始化項目
  29. npm install (or if using yarn: yarn)
  30. 運行項目
  31. npm run dev

執行上面內容後即完成了項目的所有內容,按照鏈接即可打開項目。

bug

如果在執行:

vue init webpack pm 卡死,說明node.js的版本有問題,嘗試其他穩定版,即可以解決此問題。

報錯:

  1. 39365 error code ELIFECYCLE
  2. 39366 error errno 1
  3. 39367 error [email protected] install: `node install.js`
  4. 39367 error Exit status 1
  5. 39368 error Failed at the chromedriver@2.38.3 install script.
  6. 39368 error This is probably not a problem with npm. There is likely additional logging output above.

解決鏈接

npm install chromedriver --chromedriver_cdnurl=http://cdn.npm.taobao.org/dist/chromedriver




技術分享圖片技術分享圖片

51.webpack vue-cli創建項目