在上兩篇博文中已經安裝了node.js、webpack、vue-cli,安裝的版本爲:vue
今天經過這篇博文建立項目。node
1.選擇路徑
首先經過命令行進入想要建立項目的路徑,例如:webpack
經過e:命令進入盤幅,再通過cd命令進入文件夾。web
2.建立項目
經過命令vue init webpack pm,其中pm爲你建立項目的項目名稱,在執行命令後vue-cli會下載模板,以後進行項目信息設置:vue-router
-
-
-
-
? Project description intracompany
-
-
-
? Vue build (
Use arrow keys)
-
-
-
?
Install vue-router? Yes
-
-
?
Use ESLint to lint your code? No
-
-
-
? 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
-
-
-
-
vue-cli ·
Generated "pmtext".
-
-
#
Project initialization finished!
-
# ========================
-
-
-
-
-
-
-
npm
install (or if using yarn: yarn)
-
-
執行上面內容後即完成了項目的全部內容,按照連接便可打開項目。sql
bug
若是在執行:chrome
vue init webpack pm 卡死,說明node.js的版本有問題,嘗試其餘穩定版,便可以解決此問題。vue-cli
報錯:npm
-
39365 error code ELIFECYCLE
-
-
39367 error chromedriver@2.38.3
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