创建web服务器
D:\Vue\VueExample>npm install -g live-server
C:\Users\yang\AppData\Roaming\npm\live-server -> C:\Users\yang\AppData\Roaming\npm\node_modules\live-server\live-serv
er.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\live-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"
any"} (current: {"os":"win32","arch":"x64"})
+ live-server@1.2.0
added 236 packages from 152 contributors in 31.237s
初始化前端项目(生产package.json文件,记录包的使用)
D:\Vue\VueExample>npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
package name: (vueexample)
version: (1.0.0)
description: Vue Demo
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to D:\Vue\VueExample\package.json:
{
"name": "vueexample",
"version": "1.0.0",
"description": "Vue Demo",
"main": "index.js",
"directories": {
"example": "example"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Is this OK? (yes)
启动前端项目
D:\Vue\VueExample>live-server
Serving "D:\Vue\VueExample" at http://127.0.0.1:8080
Ready for changes
GET /favicon.ico 404 4.183 ms - 24
^C终止批处理操作吗(Y/N)? y