Vue脚手架建立项目

建立一个基于webpack模板的新项目vue

D:\Git
$ vue -V
2.9.6

D:\Git
$ vue init webpack my-project ? Project name my-project
? Project description A Vue.js project
? Author hongda <hongda159505@qq.com>
? Vue build (Use arrow keys)
? Vue build standalone
? Install vue-router? Yes
? Use ESLint to lint your code? Yes
? Pick an ESLint preset Standard
? 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? (recommended) npm

   vue-cli · Generated "my-project".


# Installing project dependencies ...
# ========================

npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0

> chromedriver@2.38.3 install D:\Git\my-project\node_modules\chromedriver
> node install.js

Downloading https://chromedriver.storage.googleapis.com/2.38/chromedriver_win32.zip
Saving to C:\Users\qhong\AppData\Local\Temp\chromedriver\chromedriver_win32.zip
Received 782K...
Received 1568K...
Received 2352K...
Received 3136K...
Received 3299K total.
Extracting zip contents
Copying to target path D:\Git\my-project\node_modules\chromedriver\lib\chromedriver
Done. ChromeDriver binary available at D:\Git\my-project\node_modules\chromedriver\lib\chromedriver\chromedriver.exe

> uglifyjs-webpack-plugin@0.4.6 postinstall D:\Git\my-project\node_modules\webpack\node_modules\uglifyjs-webpack-plugin > node lib/post_install.js

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 1549 packages in 48.032s


Running eslint --fix to comply with chosen preset rules...
# ========================


> my-project@1.0.0 lint D:\Git\my-project
> eslint --ext .js,.vue src test/unit test/e2e/specs "--fix"


# Project initialization finished!
# ========================

To get started:

  cd my-project
  npm run dev

Documentation can be found at https://vuejs-templates.github.io/webpack

须要注意的是项目的名称不能大写,否则会报错。node

Project name (my-project) # 项目名称(个人项目)webpack

Project description (A Vue.js project) # 项目描述一个Vue.js 项目git

Author 做者(你的名字)github

Install vue-router? (Y/n) # 是否安装Vue路由,也就是之后是spa(但页面应用须要的模块)web

Use ESLint to lint your code? (Y/n) # 使用 ESLint 到你的代码? (Y [ yes ] / N [ no ])vue-router

Pick an ESLint preset (Use arrow keys) # 选择一个预置ESLint(使用箭头键)chrome

Setup unit tests with Karma + Mocha? (Y/n) # 设置单元测Karma + Mocha? (Y/ N)npm

Setup e2e tests with Nightwatch? (Y/n) # 设置端到端测试,Nightwatch? (Y/ N)json

固然这些都看你本身我的的状况,我这里是全选了是。

各目录用途:

安装项目所须要的依赖

npm install

运行:

$ npm run dev

> my-project@1.0.0 dev D:\Git\my-project
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

 95% emitting

 DONE  Compiled successfully in 4030ms                                                                          15:55:42


 I  Your application is running here: http://localhost:8080

提示已运行在8080端口

修改运行时自动打开浏览器:

目录中config下的index.js修改,将autoOpenBrowser:false 改成true 

意思是是否默认打开浏览器改成是。就行了

 

 

 

 

http://www.javashuo.com/article/p-tlkhkhis-et.html

https://www.jianshu.com/p/1626b8643676

相关文章
相关标签/搜索