创建react项目提示error https://registry.yarnpkg.com/......

D:\CidPlat\asdfasdfasfa>create-react-app demo7

Creating a new React app in D:\CidPlat\asdfasdfasfa\demo7.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

yarn add v1.19.0
[1/4] Resolving packages...
[2/4] Fetching packages...
error https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.7.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "EBUSY: resource busy or locked, open 'C:\\Users\\fangxin\\AppData\\Local\\Yarn\\Cache\\v5\\npm-es-abstract-1.17.7-a4de61b2f66989fc7421676c1cb9787573ace54c\\node_modules\\es-abstract\\2019\\CompletePropertyDescriptor.js'"
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

^C终止批处理操作吗(Y/N)?
^C

 

思路:每次报错的下载的包名都不一样,而且用的是https://registry.yarnpkg.com,怀疑是下载的源有问题,重新设置下 下载源,步骤如下:

npm config set registry https://registry.npm.taobao.org

npm config set disturl https://npm.taobao.org/dist

npm config rm proxy

npm config rm https-proxy

yarn config set sass-binary-site http://npm.taobao.org/mirrors/node-sass

npm config set sass-binary-site http://npm.taobao.org/mirrors/node-sass

 

然后重新执行:

D:\CidPlat\asdfasdfasfa>create-react-app demo8

Creating a new React app in D:\CidPlat\asdfasdfasfa\demo8.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

yarn add v1.19.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-scripts > @typescript-eslint/eslint-plugin > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 7 new dependencies.
info Direct dependencies
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
info All dependencies
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
Done in 49.55s.

Initialized a git repository.

Installing template dependencies using yarnpkg...
yarn add v1.19.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-scripts > @typescript-eslint/eslint-plugin > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
warning " > @testing-library/[email protected]" has unmet peer dependency "@testing-library/dom@>=7.21.4".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 17 new dependencies.
info Direct dependencies
├─ @testing-library/[email protected]
├─ @testing-library/[email protected]
├─ @testing-library/[email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
info All dependencies
├─ @testing-library/[email protected]
├─ @testing-library/[email protected]
├─ @testing-library/[email protected]
├─ @testing-library/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
Done in 9.80s.
Removing template package using yarnpkg...

yarn remove v1.19.0
[1/2] Removing module cra-template...
[2/2] Regenerating lockfile and installing missing dependencies...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
warning " > @testing-library/[email protected]" has unmet peer dependency "@testing-library/dom@>=7.21.4".
warning "react-scripts > @typescript-eslint/eslint-plugin > [email protected]" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
success Uninstalled packages.
Done in 10.77s.

Created git commit.

Success! Created demo8 at D:\CidPlat\asdfasdfasfa\demo8
Inside that directory, you can run several commands:

  yarn start
    Starts the development server.

  yarn build
    Bundles the app into static files for production.

  yarn test
    Starts the test runner.

  yarn eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd demo8
  yarn start

Happy hacking!

D:\CidPlat\asdfasdfasfa>cd demo8

D:\CidPlat\asdfasdfasfa\demo8>yarn start
yarn run v1.19.0
$ react-scripts start
i 「wds」: Project is running at http://192.168.160.1/
i 「wds」: webpack output is served from
i 「wds」: Content not from webpack is served from D:\CidPlat\asdfasdfasfa\demo8\public
i 「wds」: 404s will fallback to /
Starting the development server...
Compiled successfully!

You can now view demo8 in the browser.

  Local:            http://localhost:3000
  On Your Network:  http://192.168.160.1:3000

Note that the development build is not optimized.
To create a production build, use yarn build.
创建react项目提示error https://registry.yarnpkg.com/......_第1张图片

你可能感兴趣的:(前端,react,reactjs)