简体   繁体   中英

NPM and Yarn Registry issues while creating react app

When creating react app using create-react-app my-app it results with npm and yarn registry errors. I have tried to re-install node and set registry path as well but no luck. Please suggest a solution

C:\Users\malliswarit\Desktop>create-react-app my-app

Creating a new React app in C:\Users\malliswarit\Desktop\my-app.

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

yarn add v1.9.4
info No lockfile found.
[1/4] Resolving packages...
warning react-scripts > autoprefixer > browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > babel-preset-react-app > babel-preset-env > browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > css-loader > cssnano > autoprefixer > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > css-loader > cssnano > postcss-merge-rules > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > jest > jest-cli > istanbul-api > istanbul-lib-hook@1.2.1: 1.2.0 should have been a major version bump
warning react-scripts > css-loader > cssnano > postcss-merge-rules > caniuse-api > browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
[2/4] Fetching packages...
error An unexpected error occurred: "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-5.0.2.tgz: Request failed \"404 Not Found\"".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\malliswarit\\Desktop\\my-app\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts --cwd C:\Users\malliswarit\Desktop\my-app has failed.

Deleting generated file... package.json
Deleting generated file... yarn-error.log
Deleting my-app / from C:\Users\malliswarit\Desktop
Done.

Try yarn add with the package URL without -/ and then run create-react-app my-app :

yarn add https://registry.yarnpkg.com/react-dev-utils/react-dev-utils-5.0.2.tgz

or if using npm try:

npm install -g react-dev-utils@https://registry.npmjs.org/react-dev-utils/react-dev-utils-5.0.2.tgz

For reference, yarn add

Below are the steps done to resolve this issue. 1)npm install -g react-dev-utils@ https://registry.npmjs.org/react-dev-utils/react-dev-utils-5.0.2.tgz 2)delete .npmrc and then run 3)yarn config set strict-ssl false 4)create-react-app my-app

Issue resolved. Thanks all.

npm uninstall -g create-react-app

npm uninstall -g yarn

npm cache clean --force

npm install -g create-react-app

create-react-app cool-projecy-name

不知道是否需要卸载create-react-app和缓存清理,但这对我有用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM