运行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/

原文地址:https://www.cnblogs.com/songya/p/11072493.html