安装 dva-cli

win10,前提是正确安装了nodejs和npm,npm安装请看:https://blog.****.net/u010002184/article/details/82596389

cmd下输入:

1 npm install dva-cli -g  应该会运行3分钟左右

2 dva -v  查看版本,如果安装成功会输出版本号

3 dva new dva-quickstart   应该会运行2分钟左右,会在cmd的路径下创建文件夹dva-quickstart

4 cd dva-quickstart

5 npm start

安装 dva-cli

安装 dva-cli

记录如下:

D:\Program Files\antd>npm install dva-cli -g
npm WARN deprecated [email protected]: use [cross-spawn](https://github.com/IndigoUnited/node-cross-spawn) or [cross-spawn-async](https://github.com/IndigoUnited/node-cross-spawn-async) instead.
npm WARN deprecated [email protected]: ????  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
[ .................] / fetchMetadata: WARN deprecated [email protected]: ????  Thanks for using Babel: we recom[ .................] / fetchMetadata: WARN deprecated [email protected]: ????  Thanks for using Babel: we recom[ .................] / fetchMetadata: WARN deprecated [email protected]: ????  Thanks for using Babel: we recom[ .................] / fetchMetadata: WARN deprecated [email protected]: ????  Thanks for using Babel: we recom[ .................] / fetchMetadata: WARN deprecated babel[email protected]: ????  Thanks for using Babel: we recom[ .................] - fetchMetadata: WARN deprecated [email protected]: ????  Thanks for using Babel: we recom[ .................] | fetchMetadata: WARN deprecated [email protected]: ????  Thanks for using Babel: we recom[ .................] | fetchMetadata: WARN deprecated [email protected]: ????  Thanks for using Babel: we recom[ .................] | fetchMetadata: WARN deprecated [email protected]: ????  Thanks for using Babel: we recom[ .................] | fetchMetadata: WARN deprecated [email protected]: ????  Thanks for using Babel: we recom[ .................] | fetchMetadata: WARN deprecated [email protected]: ????  Thanks for using Babel: we recom[ .................] | fetchMetadata: WARN deprecated [email protected]: ????  Thanks for using Babel: we recom[ .................] | fetchMetadata: WARN deprecated [email protected]: ????  Thanks for using Babel: we recom[ .................] / fetchMetadata: WARN deprecated [email protected]: ????  Thanks for using Babel: we recomnpm WARN deprecated [email protected]: Package no longer supported. Contact [email protected] for more info.
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
C:\Users\liuyazhou\AppData\Roaming\npm\dva -> C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\bin\dva
+ [email protected]
added 423 packages from 277 contributors in 315.552s
a
D:\Program Files\antd>
D:\Program Files\antd>dva
Usage: dva <command> [options]

Options:

  -h, --help  output usage information
  Commands:

    init           Init a new dva application in the current folder
    new            Creates a new application
    generate       Generates new code (short-cut alias: "g")

  All commands can be run with -h (or --help) for more information.

D:\Program Files\antd>dva -v
dva-cli version 0.9.2

D:\Program Files\antd>dva new dva-quickstart
C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\bin\dva-new
Creating a new Dva app in D:\Program Files\antd\dva-quickstart.

      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\.editorconfig
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\.eslintrc
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\.roadhogrc.mock.js
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\.webpackrc
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\gitignore
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\package.json
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\mock\.gitkeep
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\src\index.css
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\src\index.js
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\src\router.js
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\public\index.html
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\src\assets\yay.jpg
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\src\models\example.js
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\src\components\Example.js
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\src\routes\IndexPage.css
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\src\routes\IndexPage.js
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\src\utils\request.js
      create  C:\Users\liuyazhou\AppData\Roaming\npm\node_modules\dva-cli\boilerplates\app\src\services\example.js
      rename  gitignore -> .gitignore
         run  npm install
use npm: npm.cmd
npm WARN deprecated [email protected]: Switch to the `bfj` package for fixes and new features!
npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated [email protected]: The major version is no longer supported. Please update to 4.x or newer
npm WARN deprecated [email protected]: Package no longer supported. Contact [email protected] for more info.

> [email protected] install D:\Program Files\antd\dva-quickstart\node_modules\husky
> node ./bin/install.js

husky
setting up hooks
Can't find .git directory, skipping Git hooks installation

> [email protected] postinstall D:\Program Files\antd\dva-quickstart\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] requires a peer of [email protected]^7.2.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @babel/[email protected]^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/[email protected] requires a peer of @babel/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @babel/[email protected] requires a peer of @babel/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @babel/[email protected] requires a peer of @babel/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected]^22.0.1 || ^22.1.0-alpha.1 || ^23.0.0-alpha.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 1888 packages from 981 contributors and audited 41891 packages in 138.855s
found 4 moderate severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
npm WARN @babel/[email protected] requires a peer of @babel/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @babel/[email protected] requires a peer of @babel/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @babel/[email protected] requires a peer of @babel/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @babel/[email protected]^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected]^7.2.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected]^22.0.1 || ^22.1.0-alpha.1 || ^23.0.0-alpha.1 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ [email protected]
updated 1 package and audited 41891 packages in 12.752s
found 4 moderate severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
npm.cmd install end

Success! Created dva-quickstart at D:\Program Files\antd\dva-quickstart.

Inside that directory, you can run several commands:
  * npm start: Starts the development server.
  * npm run build: Bundles the app into dist for production.
  * npm test: Run test.

We suggest that you begin by typing:
  cd D:\Program Files\antd\dva-quickstart
  npm start

Happy hacking!

D:\Program Files\antd>cd dva-quickstart

D:\Program Files\antd\dva-quickstart>npm start

> @ start D:\Program Files\antd\dva-quickstart
> roadhog server

  build [==                  ] 10%

Starting the development server...

Build completed in 3.22s
Compiled successfully!

You can now view Your App in the browser.

  Local:            http://localhost:8000/
  On Your Network:  http://192.168.0.104:8000/

Note that the development build is not optimized.
To create a production build, use npm run build.