vue 开发环境搭建

1.创建vue项目

1.node js 生成项目,编译项目

2.hbuilder 开发环境

1.下载安装node js

http://nodejs.cn/download/

如果安装不了 代码错误2503

解决方法:

管理员命令运行cmd;

cd\

cd C:\Users\Administrator\Desktop

msiexec/package node-v6.3.1-x64.msi

(msi是版本号)

2.安装 VUE CLI 

vue cli 是一个脚手架工具,用于生成一个基础的vue应用。

npm install vue-cli -g

3.新建一个Vue项目

cd 目录(你要把项目放在哪个目录)

  • vue init webpack pname(你的项目名字)
  • ? Project description (A Vue.js project) vue-cli新建项目(项目描述)
  • ? Author (xhdx <[email protected]>) ;[email protected](项目作者)
  • ? Vue build
    ❯ Runtime + Compiler: recommended for most users
    Runtime-only: about 6KB lighter min+gzip, but templates (or any Vue-specific HTML) are ONLY allowed in .vue files - render functions are required elsewhere
    这里选择Runtime + Compiler: recommended for most users;

  • ? Install vue-router? (Y/n) y 是否使用vue-router,这里根据需求选择;

  • ? Use ESLint to lint your code? (Y/n) y 是否使用ESLint,这里根据需求选择;

  • ? Pick an ESLint preset (Use arrow keys)
    ❯ Standard (https://github.com/feross/standard)
    Airbnb (https://github.com/airbnb/javascript) none (configure it yourself) 这里选择Standard (https://github.com/feross/standard)

  • ? Setup unit tests with Karma + Mocha? (Y/n) n 是否需要单元测试,这里根据需求选择;

  • Setup e2e tests with Nightwatch? (Y/n) n是否需要单元测试,这里根据需求选择;

  • cd pname(项目目录);

  • npm install 安装依赖

  • npm run dev 本地运行项目

 

 

 

默认浏览器会自动打开http://localhost:8080/#/,出现如下页面: 
这里写图片描述
一共13步,一个vue-cli新建的模板项目就运行起来了。

 

猜你喜欢

转载自www.cnblogs.com/yubaibai/p/10457290.html