user3463349
user3463349

Reputation: 127

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 > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > babel-preset-react-app > babel-preset-env > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > css-loader > cssnano > autoprefixer > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > css-loader > cssnano > postcss-merge-rules > [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
warning react-scripts > jest > jest-cli > istanbul-api > [email protected]: 1.2.0 should have been a major version bump
warning react-scripts > css-loader > cssnano > postcss-merge-rules > caniuse-api > [email protected]: 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.

Upvotes: 2

Views: 4157

Answers (3)

user3463349
user3463349

Reputation: 127

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.

Upvotes: 1

Komu Stephen
Komu Stephen

Reputation: 31

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

Not sure if the uninstall of create-react-app and cache clean is needed but this is what worked for me.

Upvotes: 3

Stefan Francis
Stefan Francis

Reputation: 671

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

Upvotes: 0

Related Questions