51.webpack vue-cli創建項目
阿新 • • 發佈:2018-07-17
oba lan rate 說明 操作 follow 命令 with fail
在上兩篇博文中已經安裝了node.js、webpack、vue-cli,安裝的版本為:
今天通過這篇博文創建項目。
1.選擇路徑
首先通過命令行進入想要創建項目的路徑,例如:
通過e:命令進入盤幅,再經過cd命令進入文件夾。
2.創建項目
通過命令vue init webpack pm,其中pm為你創建項目的項目名稱,在執行命令後vue-cli會下載模板,之後進行項目信息設置:
- 設置項目名稱
- ? Project name pmtext
- 設置項目描述
- ? Project description intracompany
- 作者
- ? Author hys
- ? Vue build (Use arrow keys)
- ? Vue build standalone
- 設置路由
- ? Install vue-router? Yes
- ? Use ESLint to lint your code? No
- 單元測試
- ? Set up unit tests Yes
- ? Pick a test runner jest
- ? Setup e2e tests with Nightwatch? Yes
-
? Should we run `npm install` for you after the project has been created? (recom
- ? Should we run `npm install` for you after the project has been created? (recom
- ? Should we run `npm install` for you after the project has been created? (recom
- ? Should we run `npm install` for you after the project has been created? (recom
- mended) no (此處應該選擇no)
- vue-cli · Generated "pmtext".
- # Project initialization finished!
- # ========================
- To get started:
- 提示下一步操作
- 進入pmtext文件夾
- cd pmtext
- 初始化項目
- npm install (or if using yarn: yarn)
- 運行項目
- npm run dev
執行上面內容後即完成了項目的所有內容,按照鏈接即可打開項目。
bug
如果在執行:
vue init webpack pm 卡死,說明node.js的版本有問題,嘗試其他穩定版,即可以解決此問題。
報錯:
- 39365 error code ELIFECYCLE
- 39366 error errno 1
- 39367 error [email protected] install: `node install.js`
- 39367 error Exit status 1
- 39368 error Failed at the chromedriver@2.38.3 install script.
- 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創建項目