1.安装npm(nodejs自带)
2.安装cnpm注意权限
3.通过cnpm全局安装vue -cli,同样注意权限
$ cnpm install --global vue-cli
4.创建一个基于 webpack 模板的新项目
$ vue init webpack my-project
5.配置vue
? Project name my-project
? Project description A Vue.js project
? Author guozhen
? 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 karma
? Setup e2e tests with Nightwatch? Yes
? Should we run `npm install` for you after the project has been created? (recom
mended) npm
6.进入my-project用cnpm安装,不要用npm
$ cd my-project
$ cnpm install
$ cnpm run dev
package.json里面
"dev": "node build/dev-server.js",
"build": "node build/build.js",
意思:运行”npm run dev”的时候执行的是build/dev-server.js文件,运行”npm run build”的时候执行的是build/build.js文件。
7.登录localhost:8080即可打开vue工程页面