create-react-app: Failing on installing react-scripts
If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely.
Can you reproduce the problem with latest npm?
Many errors, especially related to “missing modules”, are due to npm bugs.
If you’re using Windows, follow these instructions to update npm.
If you’re using OS X or Linux, run this to update npm:
npm install -g npm@latest
cd your_project_directory
rm -rf node_modules
npm install
Then try to reproduce the issue again.
Can you still reproduce it?
Description
What are you reporting?
When I create a project with create-react-app
, it has failing on installing react-scripts
package.
I am not sure this is create-react-app
issue or yarnpkg
issue because when I tried to install react-scripts
with yarnpkg
separately, it has same issue. However, current create-react-app
depends on the yarnpkg
which has issue, I think it should be addressed.
Expected behavior
It should create a project without aborting, or if it is aborted, it should not delete the folder. Since it deletes the folder, the yarn-error.log file is gone.
Actual behavior
Got this message.
mshin@1s5cj12-l ~/Workspace/github create-react-app test-app
Creating a new React app in /Users/mshin/Workspace/github/test-app.
Installing packages. This might take a couple minutes.
Installing react, react-dom, and react-scripts...
yarn add v0.24.5
info No lockfile found.
[1/4] 🔍 Resolving packages...
error An unexpected error occurred: "https://registry.npmjs.org/@timer%2fdetect-port: Could not authenticate npm".
info If you think this is a bug, please open a bug report with the information provided in "/Users/mshin/Workspace/github/test-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 has failed.
Deleting generated file... package.json
Deleting generated file... yarn-error.log
Deleting test-app / from /Users/mshin/Workspace/github
Done.
Environment
Run these commands in the project folder and fill in their results:
npm ls react-scripts
(if you haven’t ejected):node -v
: v6.9.5npm -v
: 3.10.10
Then, specify:
- Operating system: Mac OS Sierra 10.12.5
- Browser and version: N/A
Reproducible Demo
mshin@1s5cj12-l ~/Workspace/github create-react-app test-app
Creating a new React app in /Users/mshin/Workspace/github/test-app.
Installing packages. This might take a couple minutes.
Installing react, react-dom, and react-scripts...
yarn add v0.24.5
info No lockfile found.
[1/4] 🔍 Resolving packages...
error An unexpected error occurred: "https://registry.npmjs.org/@timer%2fdetect-port: Could not authenticate npm".
info If you think this is a bug, please open a bug report with the information provided in "/Users/mshin/Workspace/github/test-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 has failed.
Deleting generated file... package.json
Deleting generated file... yarn-error.log
Deleting test-app / from /Users/mshin/Workspace/github
Done.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 21 (9 by maintainers)
Can you try running
yarn logout
andnpm logout
? Then try to setup an app again.Looks like a Yarn bug. Can you try uninstalling Yarn and trying again?
We should add some way to fall back to npm on errors in Yarn but we don’t have that code yet.
@cdelaorden removing _auth only should work as well
I was having the same issue and can confirm that deleting the
~/.npmrc
file (notice it’s in my user home folder) fixes it allowing to use CRA from scratch. No need to uninstall yarn and so on.You can uninstall Yarn in the meantime to get CRA to use npm.