How to solve npm ERR! code ELIFCYLCE
Yesterday my clients shared a git repository to me, consist of a web projects built with Next.js. He asked me to do some modification and add new feature to the project.
Long story short, I’ve clone the project into my local environment and when I tried to run the projects locally, with npm install
, npm run dev
command, surprisingly this error appear:
My first assumption is, “oh maybe just update the npm package with ‘npm update’ command and everything should be OK!”
But, it doesn’t work at all! The issue are still there. So after do some research, apparently the issues caused by outdated react-scripts. I try to do these steps:
- Remove node_modules →
rm -rf node_modules
- Remove package-lock.json →
rm package-lock.json
- Run command →
npm i -s — save-exact react-scripts@desired_version
where the desired_version is the latest version - Run
npm install
again - Run
npm run dev
And sometimes it works, but sometimes the error suddenly appear again ☹️
So I decide to change the build command, from npm to yarn. Probably it will works 🤷♂️
- Remove node_modules
- Remove package-lock.json
- Run
yarn install
- Run
yarn upgrade --latest react-scripts
- Run
yarn upgrade --latest
(optional) - Run
yarn dev
and voila 🎊 it works!!!
Now the Next.js project can run smoothly on my localhost! I hope this solution will work for you also, in case you are facing the same issues.
or if you have a better approach, please do let me know 🙂
Don't subscribe