vue环境搭建与demo

1、npm 已安装

     查看版本信息:npm -v

2、升级npm[重要-否则产生很多问题]

    cnpm install npm -g

3、安装vue

      cnpm install vue

4、新建vue工程demo

# 全局安装 vue-cli //一定要使用npm 而不是 cnpm 否则会因为依赖包安装不全而产生问题
$ sudo npm install --global vue-cli
# 创建一个基于 webpack 模板的新项目
$ vue init webpack my-project
# 这里需要进行一些配置,默认回车即可
This will install Vue 2.x version of the template.

For Vue 1.x use: vue init webpack#1.0 my-project

? Project name my-project
? Project description A Vue.js project
? Author runoob <test@runoob.com>
? Vue build standalone
? Use ESLint to lint your code? Yes
? Pick an ESLint preset Standard
? Setup unit tests with Karma + Mocha? Yes
? Setup e2e tests with Nightwatch? Yes

   vue-cli · Generated "my-project".

   To get started:
   
     cd my-project
     npm install
     npm run dev
   
   Documentation can be found at https://vuejs-templates.github.io/webpack
5、进入项目,安装并运行:

$ cd my-project
$ cnpm install //npm 命令会由于“墙”的存在而无法安装,使用cnpm避免
$ cnpm run dev
 DONE  Compiled successfully in 4388ms

> Listening at http://localhost:8080

扫描二维码关注公众号,回复: 4035283 查看本文章

猜你喜欢

转载自blog.csdn.net/hhbbeijing/article/details/65446083