安装
npm install -g @vue/cli
创建项目
➜ nodejs git:(master) vue create vue-demo
ue CLI v4.5.15
? Please pick a preset: Manually select features
? Check the features needed for your project:
◉ Choose Vue version
◉ Babel
◯ TypeScript
◯ Progressive Web App (PWA) Support
◉ Router
◉ Vuex
◉ CSS Pre-processors
❯◯ Linter / Formatter
◯ Unit Testing
◯ E2E Testing
Vue CLI v4.5.15
? Please pick a preset: Manually select features
? Check the features needed for your project: Choose Vue version, Babel, Router, Vuex, CSS Pre-processors
? Choose a version of Vue.js that you want to start the project with 3.x
? Use history mode for router? (Requires proper server setup for index fallback in production) No
? Pick a CSS pre-processor (PostCSS, Autoprefixer and CSS Modules are supported by default): Less
? Where do you prefer placing config for Babel, ESLint, etc.? In dedicated config files
? Save this as a preset for future projects? Yes
? Save preset as: hello-vue
🎉 Preset hello-vue saved in /Users/moilions/.vuerc
Vue CLI v4.5.15
✨ Creating project in /Users/moilions/mayun/nodejs/vue-demo.
⚙️ Installing CLI plugins. This might take a while...
added 1240 packages in 25s
10 packages are looking for funding
run `npm fund` for details
🚀 Invoking generators...
📦 Installing additional dependencies...
added 36 packages in 6s
10 packages are looking for funding
run `npm fund` for details
⚓ Running completion hooks...
📄 Generating README.md...
🎉 Successfully created project vue-demo.
👉 Get started with the following commands:
$ cd vue-demo
$ npm run serve
➜ nodejs git:(master) ✗
启动项目
➜ vue-demo git:(master) ✗ pwd
/Users/moilions/mayun/nodejs/vue-demo
➜ vue-demo git:(master) ✗ npm run serve
> vue-demo@0.1.0 serve
> vue-cli-service serve
INFO Starting development server...
98% after emitting CopyPlugin
DONE Compiled successfully in 2334ms 下午10:08:37
App running at:
- Local: http://localhost:8080/
- Network: http://192.168.50.245:8080/
Note that the development build is not optimized.
To create a production build, run npm run build.
浏览器中访问http://localhost:8080/即可