win10,前提是正确安装了nodejs和npm,npm安装请看:https://blog.csdn.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
记录如下:
D:\Program Files\antd>npm install dva-cli -g
npm WARN deprecated win-spawn@2.0.0: 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 babel-preset-es2015@6.24.1: ? Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
[ .................] / fetchMetadata: WARN deprecated babel-preset-es2015@6.24.1: ? Thanks for using Babel: we recom[ .................] / fetchMetadata: WARN deprecated babel-preset-es2015@6.24.1: ? Thanks for using Babel: we recom[ .................] / fetchMetadata: WARN deprecated babel-preset-es2015@6.24.1: ? Thanks for using Babel: we recom[ .................] / fetchMetadata: WARN deprecated babel-preset-es2015@6.24.1: ? Thanks for using Babel: we recom[ .................] / fetchMetadata: WARN deprecated babel-preset-es2015@6.24.1: ? Thanks for using Babel: we recom[ .................] - fetchMetadata: WARN deprecated babel-preset-es2015@6.24.1: ? Thanks for using Babel: we recom[ .................] | fetchMetadata: WARN deprecated babel-preset-es2015@6.24.1: ? Thanks for using Babel: we recom[ .................] | fetchMetadata: WARN deprecated babel-preset-es2015@6.24.1: ? Thanks for using Babel: we recom[ .................] | fetchMetadata: WARN deprecated babel-preset-es2015@6.24.1: ? Thanks for using Babel: we recom[ .................] | fetchMetadata: WARN deprecated babel-preset-es2015@6.24.1: ? Thanks for using Babel: we recom[ .................] | fetchMetadata: WARN deprecated babel-preset-es2015@6.24.1: ? Thanks for using Babel: we recom[ .................] | fetchMetadata: WARN deprecated babel-preset-es2015@6.24.1: ? Thanks for using Babel: we recom[ .................] | fetchMetadata: WARN deprecated babel-preset-es2015@6.24.1: ? Thanks for using Babel: we recom[ .................] / fetchMetadata: WARN deprecated babel-preset-es2015@6.24.1: ? Thanks for using Babel: we recomnpm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
npm WARN deprecated minimatch@2.0.10: 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
+ dva-cli@0.9.2
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 bfj-node4@5.3.1: Switch to the `bfj` package for fixes and new features!
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated hoek@2.16.3: The major version is no longer supported. Please update to 4.x or newer
npm WARN deprecated nomnom@1.6.2: Package no longer supported. Contact support@npmjs.com for more info.
> husky@0.12.0 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
> uglifyjs-webpack-plugin@0.4.6 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 eslint-config-react-app@2.1.0 requires a peer of babel-eslint@^7.2.3 but none is installed. You must install peer dependencies yourself.
npm WARN babel-loader@8.0.2 requires a peer of @babel/core@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-proposal-export-namespace@7.0.0-beta.32 requires a peer of @babel/core@7.0.0-beta.32 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-proposal-export-default@7.0.0-beta.32 requires a peer of @babel/core@7.0.0-beta.32 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-syntax-export-extensions@7.0.0-beta.32 requires a peer of @babel/core@7.0.0-beta.32 but none is installed. You must install peer dependencies yourself.
npm WARN ts-jest-babel-7@22.0.7 requires a peer of jest@^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: fsevents@1.2.4 (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"})
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/plugin-proposal-export-default@7.0.0-beta.32 requires a peer of @babel/core@7.0.0-beta.32 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-proposal-export-namespace@7.0.0-beta.32 requires a peer of @babel/core@7.0.0-beta.32 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-syntax-export-extensions@7.0.0-beta.32 requires a peer of @babel/core@7.0.0-beta.32 but none is installed. You must install peer dependencies yourself.
npm WARN babel-loader@8.0.2 requires a peer of @babel/core@^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@2.1.0 requires a peer of babel-eslint@^7.2.3 but none is installed. You must install peer dependencies yourself.
npm WARN ts-jest-babel-7@22.0.7 requires a peer of jest@^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: fsevents@1.2.4 (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"})
+ dva@2.4.0
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.