I\'m trying to learn react, so I have this sample code for the full-stack react voting app, and I am trying to get it to work but after running npm install followed by npm s
React Application: For me the issue was that after running npm install
had some errors.
I've went with the recommendation npm audit fix
. This operation broke my package.json
and package-lock.json
(changed version of packages and and structure of .json).
THE FIX WAS:
npm install
npm start
Hope this will be helpfull for someone.
I recommend you update your node version to the latest node version recommended by your application or for short update your node version. I encountered this same problem using node version 11.1 but my application was recommending atleast version 10.x.x or 12.x.x I tried all the suggested reply on this thread but non seemed to work for me untill only when i updated my node version to the recommended latest version .i.e. version 12.16.3 then my application ran.
Cleaning Cache
and Node_module
are not enough.
Follow this steps:
npm cache clean --force
node_modules
folderpackage-lock.json
filenpm install
It works for me like this.
I was getting similar error messages on a 16.04 Ubuntu instance with DigitalOcean while running npm run build
on an app made with create-react-app
(link). I upgraded the instance from 512MB RAM to 1GB ($5/mo to $10/mo) and then the script was able to run.
I post this here to point out that you may get this error due to resource limitations, which I didn't really see explained elsewhere on issue pages and SO answers. And nothing I saw in the error logs pointed me in this direction.
Its weird but it works for me
Go to
control panel -->System and Security--> System --> Advanced System Security--> Environment Variables
In Environment Variable popup you will edit the user variable PATH and add "C:\Windows\System32" value as semicolon separated to the existing value.
Not but not least restart the Machine.
A possibly unexpected cause: you use Create React App with some warnings left unfixed, and the project fails on CI (e.g. GitLab CI/CD):
Treating warnings as errors because process.env.CI = true.
[ ... some warnings here ...]
npm ERR! code ELIFECYCLE
npm ERR! errno 1
Solution: fix yo' warnings!
Alternative: use CI=false npm run build
See CRA issue #3657
(Ashamed to admit that it just happened to me; did not see it until a colleague pointed it out. Thanks Pascal!)