Vue.js 提供一个官方命令行工具,可用于快速搭建大型单页应用。该工具提供开箱即用的构建工具配置,带来现代化的前端开发流程。
只需几分钟即可创建并启动一个带热重载、保存时静态检查以及可用于生产环境的构建配置的项目:
# 全局安装 vue-cli
$ npm install --global vue-cli
# 创建一个基于 webpack 模板的新项目
$ vue init webpack my-project
$ vue init webpack test //输入命令
? Project name (test) test
? Project name test
? Project description (A Vue.js project) 测试项目
? Project description 测试项目
? Author lxx1024
? Author lxx1024
? Vue build standalone
? Install vue-router? (Y/n) Y //安装路由
? Install vue-router? Yes
? Use ESLint to lint your code? (Y/n) n //Eslint验证,很严谨,所以选择n
? Use ESLint to lint your code? No
? Setup unit tests with Karma + Mocha? (Y/n) Y
? Setup unit tests with Karma + Mocha? Yes
? Setup e2e tests with Nightwatch? (Y/n) Y
? Setup e2e tests with Nightwatch? Yes
vue-cli · Generated "test".
To get started:
cd test
npm install
npm run dev
Documentation can be found at https://vuejs-templates.github.io/webpack
# 安装依赖,走你
$ cd my-project
$ npm install
$ npm run dev //运行项目
> npm install
> phantomjs-prebuilt@2.1.15 install C:Users81487Desktoptestnode_modulesphantomjs-prebuilt
> node install.js
PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-windows.zip
Saving to C:Users81487AppDataLocalTempphantomjsphantomjs-2.1.1-windows.zip
Receiving...
Error making request.
Error: connect ETIMEDOUT 54.231.81.168:443
at Object.exports._errnoException (util.js:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
Please report this full log at https://github.com/Medium/phantomjs
test@1.0.0 C:Users81487Desktoptest
+-- autoprefixer@7.1.5
| +-- browserslist@2.5.1
| | `-- electron-to-chromium@1.3.26
| +-- caniuse-lite@1.0.30000746
| +-- normalize-range@0.1.2
| +-- num2fraction@1.2.2
| +-- postcss@6.0.13
| `-- postcss-value-parser@3.3.0
+-- babel-core@6.26.0
| +-- babel-code-frame@6.26.0
| | +-- chalk@1.1.3
| | | +-- ansi-styles@2.2.1
| | | `-- supports-color@2.0.0
| | +-- esutils@2.0.2
| | `-- js-tokens@3.0.2
| +-- babel-generator@6.26.0
| | +-- detect-indent@4.0.0
| | | `-- repeating@2.0.1
| | | `-- is-finite@1.0.2
| | | `-- number-is-nan@1.0.1
| | +-- jsesc@1.3.0










