运行antd pro v4

Posted songya

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了运行antd pro v4相关的知识,希望对你有一定的参考价值。

1、安装yarn

curl -o- -L https://yarnpkg.com/install.sh | bash

 

出现了提示信息:

> WARNING: GPG is not installed, integrity can not be verified!

> Extracting to ~/.yarn...

> Adding to $PATH...

> Profile not found. Tried  (as defined in $PROFILE), ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile.

> Create one of them and run this script again

> Create it (touch ) and run this script again

   OR

> Append the following lines to the correct file yourself:

 

export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"

 

将最后一行,放到命令行即可。

2、yarn create umi my-app

  cd my-app

3、yarn

warning Error running install script for optional dependency: "/Users/songya/antdpro/my-app/node_modules/puppeteer: Command failed.

Exit code: 1

Command: node install.js

Arguments: 

Directory: /Users/songya/antdpro/my-app/node_modules/puppeteer

Output:

ERROR: Failed to download Chromium r669486! Set \"PUPPETEER_SKIP_CHROMIUM_DOWNLOAD\" env variable to skip download.

Error: read ETIMEDOUT

    at TLSWrap.onStreamRead (internal/stream_base_commons.js:111:27)

  -- ASYNC --

    at BrowserFetcher.<anonymous> (/Users/songya/antdpro/my-app/node_modules/puppeteer/lib/helper.js:111:15)

    at Object.<anonymous> (/Users/songya/antdpro/my-app/node_modules/puppeteer/install.js:64:16)

    at Module._compile (internal/modules/cjs/loader.js:707:30)

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:718:10)

    at Module.load (internal/modules/cjs/loader.js:605:32)

    at tryModuleLoad (internal/modules/cjs/loader.js:544:12)

    at Function.Module._load (internal/modules/cjs/loader.js:536:3)

报错:ERROR: Failed to download Chromium r669486! Set \"PUPPETEER_SKIP_CHROMIUM_DOWNLOAD\" env variable to skip download.

解决方法:npm install -g cnpm --registry=https://registry.npm.taobao.org

     cnpm i puppeteer

4、yarn start

?  error     Error: Cannot find module ‘react‘ 

 

解决方法:yarn add react

 

 

 

warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.

 

 

解决方法:rm package-lock.json

5、yarn start

App running at:

  - Local:   http://localhost:8000/ (copied to clipboard)

  - Network: http://10.28.175.13:8000/

以上是关于运行antd pro v4的主要内容,如果未能解决你的问题,请参考以下文章

移除antd pro中的 路由的国际化

antd v3 升级 v4

Ant Design Pro V4.5 从服务器请求菜单图标不显示解决

antd从v3升级到v4记录

pro.antd.design

【antd-pro】路由配置、select组件层级