搭建vue开发环境

   搭建vue开发环境

C:Users16335>node -v
v10.16.0

C:Users16335>vue-cli
'vue-cli' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:Users16335>npm install vue
npm WARN saveError ENOENT: no such file or directory, open 'C:Users16335package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open 'C:Users16335package.json'
npm WARN 16335 No description
npm WARN 16335 No repository field.
npm WARN 16335 No README data
npm WARN 16335 No license field.

+ vue@2.6.10
added 1 package from 1 contributor and audited 1 package in 6.154s
found 0 vulnerabilities


C:Users16335>vue -version
'vue' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:Users16335>vue
'vue' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:Users16335>npm uninstall vue
npm WARN saveError ENOENT: no such file or directory, open 'C:Users16335package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:Users16335package.json'
npm WARN 16335 No description
npm WARN 16335 No repository field.
npm WARN 16335 No README data
npm WARN 16335 No license field.

removed 1 package in 1.821s
found 0 vulnerabilities


C:Users16335>npm install --global vue-cli
npm WARN deprecated vue-cli@2.9.6: This package has been deprecated in favour of @vue/cli
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
C:Users16335AppDataRoaming
pmvue -> C:Users16335AppDataRoaming
pm
ode_modulesvue-cliinvue
C:Users16335AppDataRoaming
pmvue-init -> C:Users16335AppDataRoaming
pm
ode_modulesvue-cliinvue-init
C:Users16335AppDataRoaming
pmvue-list -> C:Users16335AppDataRoaming
pm
ode_modulesvue-cliinvue-list
+ vue-cli@2.9.6
added 241 packages from 206 contributors in 105.877s

C:Users16335>vue
Usage: vue <command> [options]

Options:
  -V, --version  output the version number
  -h, --help     output usage information

Commands:
  init           generate a new project from a template
  list           list available official templates
  build          prototype a new project
  create         (for v3 warning only)
  help [cmd]     display help for [cmd]

C:Users16335>vue -v
error: unknown option `-v'

C:Users16335>vue -V
2.9.6

C:Users16335>D:

D:>vue init webpack Vue_first

'git' �����ڲ����ⲿ���Ҳ���ǿ����еij���
���������ļ���
? Project name vue-first
? Project description A Vue.js project
? Author Sufeng
? 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 jest
? Setup e2e tests with Nightwatch? Yes
? Should we run `npm install` for you after the project has been created? (recommended) npm

   vue-cli · Generated "Vue_first".


# Installing project dependencies ...
# ========================

npm WARN deprecated extract-text-webpack-plugin@3.0.2: Deprecated. Please use https://github.com/webpack-contrib/mini-css-extract-plugin
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated bfj-node4@5.3.1: Switch to the `bfj` package for fixes and new features!
npm WARN deprecated json3@3.3.2: Please use the native JSON object instead of JSON 3
npm WARN deprecated flatten@1.0.2: I wrote this module a very long time ago; you should use something else.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()

> chromedriver@2.46.0 install D:Vue_first
ode_moduleschromedriver
> node install.js

Current existing ChromeDriver binary is unavailable, proceding with download and extraction.
Downloading from file:  https://chromedriver.storage.googleapis.com/2.46/chromedriver_win32.zip
Saving to file: C:Users16335AppDataLocalTemp2.46chromedriverchromedriver_win32.zip
终止批处理操作吗(Y/N)? y

D:>cd vue_first

D:Vue_first>npm install
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.

audited 32205 packages in 9.077s
found 84 vulnerabilities (65 low, 7 moderate, 11 high, 1 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

D:Vue_first>npm run dev

> vue-first@1.0.0 dev D:Vue_first
> webpack-dev-server --inline --progress --config build/webpack.dev.conf.js

 12% building modules 23/31 modules 8 active ...late&index=0!D:Vue_firstsrcApp.vue{ parser: "babylon" 95% emitting

 DONE  Compiled successfully in 4038ms                                                                                                                                             1:19:39 PM

 I  Your application is running here: http://localhost:8080

 运行效果:

 代码结构

原文地址:https://www.cnblogs.com/zhishiyv/p/11562595.html