facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.76k stars 26.87k forks source link

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

Closed neonwired closed 7 years ago

neonwired commented 7 years ago

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

gaearon commented 7 years ago

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

Timer commented 7 years ago

This diagnostic code is now in create-react-app@1.3.0, if you could test the new version and provide the output, that'd be great!

npm install -g create-react-app@latest
neonwired commented 7 years ago

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 babel-preset-latest@6.22.0: πŸ’₯ 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.

gaearon commented 7 years ago

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.

neonwired commented 7 years ago

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

gaearon commented 7 years ago

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

ripplesphere commented 7 years ago

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/

gaearon commented 7 years ago

@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.

ripplesphere commented 7 years ago

@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.

gaearon commented 7 years ago

Thanks. I guess there’s nothing actionable in this issue then.

viankakrisna commented 7 years ago

@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.

gaearon commented 7 years ago

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

viankakrisna commented 7 years ago

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.

gaearon commented 7 years ago

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.

viankakrisna commented 7 years ago

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

TheBlusky commented 7 years ago

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.

gaearon commented 7 years ago

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 πŸ˜„

TheBlusky commented 7 years ago

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.

gaearon commented 7 years ago

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).

TheBlusky commented 7 years ago

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 :-)

monsterooo commented 7 years ago

Restart my computer, it works~ try ~

lxcid commented 7 years ago

In my case, it was unsafe-perm=false in ~/.npmrc causing some permissions issue.

86272 error Darwin 16.5.0
86273 error argv "/usr/local/Cellar/node/7.7.4/bin/node" "/usr/local/bin/npm" "install" "--save" "--save-exact" "react" "react-dom" "react-scripts"
86274 error node v7.7.4
86275 error npm  v4.1.2
86276 error code EPERM
86277 error errno EPERM
86278 error syscall spawn
86279 error Error: spawn EPERM
86279 error     at exports._errnoException (util.js:1034:11)
86279 error     at ChildProcess.spawn (internal/child_process.js:319:11)
86279 error     at exports.spawn (child_process.js:378:9)
86279 error     at spawn (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:21:13)
86279 error     at runCmd_ (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:271:14)
86279 error     at /usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:235:7
86279 error     at _combinedTickCallback (internal/process/next_tick.js:73:7)
86279 error     at process._tickCallback (internal/process/next_tick.js:104:9)
86279 error  { Error: spawn EPERM
86279 error     at exports._errnoException (util.js:1034:11)
86279 error     at ChildProcess.spawn (internal/child_process.js:319:11)
86279 error     at exports.spawn (child_process.js:378:9)
86279 error     at spawn (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:21:13)
86279 error     at runCmd_ (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:271:14)
86279 error     at /usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:235:7
86279 error     at _combinedTickCallback (internal/process/next_tick.js:73:7)
86279 error     at process._tickCallback (internal/process/next_tick.js:104:9) code: 'EPERM', errno: 'EPERM', syscall: 'spawn' }
86280 error Please try running this command again as root/Administrator.
86281 verbose exit [ 1, true ]
astannard commented 7 years ago

I had this issue and spent a long while trying to fix it, this is what worked for me. uninstalling and then reinstalling yarn. Then all worked fine, hope that helps someone

codenoid commented 7 years ago

same, ubuntu 16.04, node -v 7.10

gaearon commented 7 years ago

If you have this issue it means npm is failing. Look at the log and hopefully you'll see why this happens. If not please raise a new issue with more information.

rhalfi commented 7 years ago

for me fixed by running sudo chown -R $(whoami) "$HOME/.npm", after first making sure that upgraded to the latest stable version of npm (npm -g install npm).

devdil commented 7 years ago

Updating node and npm fixed the issue for me @rhalfi πŸ‘

petardfoozer commented 7 years ago

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/

This solved my problem. Seems the lower end Digital Ocean droplets don't have the required RAM to bring up the installation

javaherian commented 7 years ago

@ripplesphere @petardfoozer That link seems to be dead, but I think it's the correct solution.

Here is a cached version

http://webcache.googleusercontent.com/search?q=cache:https://www.davidmeents.com/blog/how-to-simply-deploy-a-react-app-on-digital-ocean/

ahmadSaeedGoda commented 7 years ago

Had same issue. Creating some swap space seems to fix the issue. thanks to https://github.com/ripplesphere

pavsh commented 7 years ago

had same issue. Creating some swap space seems to fix the issue. used this guide for adding 1GB swap:

patrickdundas commented 7 years ago

Creating swap space worked for me too! @javaherian @ripplesphere @petardfoozer the link has moved to here https://www.davidmeents.com/?p=30

joglr commented 6 years ago

I am experiencing this issue on windows. Updating npm doesn't fix it for me. OS: Windows 10 Pro 64 bit Node version: 8.9.4 NPM version: 5.8.0 CRA version: 1.5.2

I get the following output:

+ react-scripts@1.1.1
+ react@16.2.0
+ react-dom@16.2.0
added 1327 packages from 785 contributors in 64.722s
npm verb exit [ 0, true ]
npm info ok

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

Deleting generated file... node_modules
Deleting generated file... package.json
Done.
imagineLife commented 6 years ago

Hello! I have this same

JakesMBP:projects Jake$ create-react-app socket2client

Creating a new React app in /Users/Jake/Desktop/projects/socket2client.

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

npm ERR! asyncWrite is not a function
npm ERR! pna.nextTick is not a function

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/Jake/.npm/_logs/2018-06-10T11_42_17_660Z-debug.log

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

Deleting generated file... package.json
Deleting socket2client / from /Users/Jake/Desktop/projects
Done.

I'm using npm 6.1.0 node 10.4

Is this still considered an NPM issue? Thanks!

bugzpodder commented 6 years ago

Hi guys, I recommend filing a new issue if you run into a problem rather than commenting on a closed one

iAfolayan commented 6 years ago

npm ERR! Unexpected end of JSON input while parsing near '...s":"~1.5.0","mime":"1'

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\JSTMI\AppData\Roaming\npm-cache_logs\2018-08-22T17_54_00_294Z-debug.log

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

Deleting generated file... package.json Deleting message-app / from C:\reactjs Done.

$ npm -v 6.4.0

$ node -v v8.9.3

Windows 10

raunak1 commented 6 years ago

Hello guys i am facing some issue when i install react npm install --save --save-exact --loglevel error react react-dom react-scripts has failed. can you please help me to describe actually what should i do

pnecas commented 6 years ago

Just uninstall yarn or re-install it may fix this.

Lninn commented 6 years ago

This diagnostic code is now in create-react-app@1.3.0, if you could test the new version and provide the output, that'd be great!

npm install -g create-react-app@latest

Thanks!

awakeel commented 6 years ago

Same issue, I have tried all commands, but still not working

create-react-app users

Creating a new React app in C:\Users\Abdul Wakeel\Desktop\envato\users.

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

yarn add v1.10.1 [1/4] Resolving packages... [2/4] Fetching packages... error eslint@5.6.0: The engine "node" is incompatible with this module. Expected version "^6.14.0 || ^8.10.0 || >=9.10.0". Got "8.9.4" error Found incompatible module 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\Abdul Wakeel\Desktop\envato\users has failed.

Deleting generated file... package.json Deleting generated file... yarn.lock Deleting users/ from C:\Users\Abdul Wakeel\Desktop\envato Done.

bugzpodder commented 6 years ago

@awakeel as the error suggests, you should use a newer version of node. You are using 8.9.4, you should probably use 8.12.0 LTS.

VenkatGupta31 commented 6 years ago

npm cache clean --force and ran create-react-app my-app solved the issue for me. Try it..

https://stackoverflow.com/questions/47180722/create-react-app-failing-to-create-a-new-react-app-in-windows-10/53047243#53047243

codenoid commented 6 years ago

unfollow this issue