create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

Aborting installation. npm install --save --save-exact react react-dom react-scripts has failed.

Open neonwired opened this issue 9 years ago โ€ข 43 comments

getting Aborting installation. npm install --save --save-exact react react-dom react-scripts has failed.

npm version 4.1.2 node version 7.7.1

neonwired avatar Mar 06 '17 03:03 neonwired

Can you post a complete console output? Also could you please follow these diagnostic steps and report the result?

gaearon avatar Mar 06 '17 03:03 gaearon

This diagnostic code is now in [email protected], if you could test the new version and provide the output, that'd be great!

npm install -g create-react-app@latest

Timer avatar Mar 06 '17 20:03 Timer

Creating a new React app in /home/project-penguin.

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

npm WARN deprecated [email protected]: ๐Ÿ’ฅ preset-latest accomplishes the same task as babel-preset-env. ๐Ÿ™ Please install it with 'npm install babel-preset-env --save-dev'. '{ "presets": ["latest"] }' to '{ "presets": ["env"] }'. For more info, please check the docs: http://babeljs.io/docs/plugins/preset-env ๐Ÿ‘Œ. And let us know how you're liking Babel at @babeljs on ๐Ÿฆ [ .....] \ extract:camel-case: verb gentlyRm don't care about conte Aborting installation. npm install --save --save-exact react react-dom react-scripts has failed.

neonwired avatar Mar 07 '17 02:03 neonwired

Which OS are you using? Have you tried using npm 3.x? It may be a new bug.


Note to self: we should probably salvage npm log instead of nuking the directory. We should just make sure it's possible to create app with the same name again, but npm log should stay so people can attach it to bug reports.

gaearon avatar Mar 07 '17 03:03 gaearon

I can only replicate it on Ubuntu 16.04, my other stacks using 14.04 seem ok.

neonwired avatar Mar 07 '17 03:03 neonwired

This looks like an npm bug so I recommend trying different npm versions.

gaearon avatar Mar 07 '17 03:03 gaearon

Had same issue on a basic Digital Ocean server. Creating some swap space seems to fix the issue. See: https://www.davidmeents.com/blog/how-to-simply-deploy-a-react-app-on-digital-ocean/

ripplesphere avatar Mar 08 '17 15:03 ripplesphere

@ripplesphere Can you post the whole output of the command when it fails? It would be helpful so we can figure out how to better explain the problem in the CLI itself. I don't think https://github.com/facebookincubator/create-react-app/issues/1735#issuecomment-284605778 shows the complete output.

gaearon avatar Mar 08 '17 16:03 gaearon

@gaearon Sorry. I fixed the problem and closed the terminal. The 'create-react-app hello-world' command would run for a while and then be "killed". It would happen at different locations in the process, which is why I suspected a resource issue.

ripplesphere avatar Mar 08 '17 16:03 ripplesphere

Thanks. I guess thereโ€™s nothing actionable in this issue then.

gaearon avatar Mar 08 '17 16:03 gaearon

@gaearon Is it worth it to find the cause of memory issue? Seems that it's alienating for people with low resources. Or we should add a minimum memory requirements in the read me. I have also experienced create-react-app killed because of the memory while working in c9. Since then, I'm working locally for create-react-app.

viankakrisna avatar Mar 08 '17 16:03 viankakrisna

We can't make npm consume less memory. I don't see a solution here.

gaearon avatar Mar 08 '17 16:03 gaearon

hmm, in my case it's killed while running the devServer. It's happening a long time a go. Will open another issue when I can make a reproducible case.

viankakrisna avatar Mar 08 '17 16:03 viankakrisna

Yes, but that's not what this particular issue was about (it was about npm). We mention it in the docs for build: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-silently-fails. Maybe we should make that entry more generic.

gaearon avatar Mar 08 '17 16:03 gaearon

Thanks for the link, yeah I think we can add this npm (or any memory related ) issue in the read me.

viankakrisna avatar Mar 08 '17 17:03 viankakrisna

I had exactly the same issue ! I tried to uninstall node, npm, create-react-app many times... Finally, I ended up modifying the "index.js" file of create-react-app script with the following :

Before:

      return install(useYarn, allDependencies, verbose, isOnline).then(function() {
        return packageName;
      });

After:

      return install(useYarn, allDependencies, verbose, isOnline).then(function() {
        return packageName;
      }).catch(function() {return packageName;});

This is a really dirty hack, but it worked fine.

TheBlusky avatar Mar 16 '17 20:03 TheBlusky

Can you post the error message you got? Itโ€™s cool that you caught the error but it would be more useful to know what error it was so that we can fix it ๐Ÿ˜„

gaearon avatar Mar 16 '17 20:03 gaearon

My bad :-) I was so glad to finally be able to create a React App I didn't go further. The error message is: { command: 'npm install --save --save-exact react react-dom react-scripts' }. I think it's an NPM issue, packages are well installed, but NPM exit without a success behavior.

TheBlusky avatar Mar 16 '17 20:03 TheBlusky

Oh I see. In this case this should have been printed.

We should keep the logs in such cases. It might have worked for you but it's still unsafe (e.g. likely to produce broken installs).

gaearon avatar Mar 16 '17 21:03 gaearon

Yes, that's why I said it is a "really dirty" hack. In fact, I tested the npm install --save --save-exact react react-dom react-scripts command manually. It exited promptly but was able to check whether or not packages were installed.

I wouldn't advise to implement my workaround, but it may be useful if someone is brave enough to try it manually :-)

TheBlusky avatar Mar 16 '17 21:03 TheBlusky