Not Compatible with Your Version of Node/Npm (Node 14 to Node 18)

I am trying to upgrade my react 17 application to a newer version of node and npm. Currently, my application is running on 14.17.2. I need the application to bump to 18.14.2 in order for me to dockerize it with a container found in docker's official repository.

In order to do so, I've used nvm to install node 18.14.2 and that upgraded my npm to 9.5.0. Furthermore for this portion of the package.json, I did the following under the engines subsection:

"engines": {
    "node": "18.14.2",
    "npm": "9.5.0"
  }

However, when I execute npm i with the new upgraded packages I receive the following message:

npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: @casl/[email protected]
npm ERR! notsup Not compatible with your version of node/npm: @casl/[email protected]
npm ERR! notsup Required: {"npm":"^6.0.0"}
npm ERR! notsup Actual:   {"npm":"9.5.0","node":"v18.14.2"}

I don't understand what this is asking me to do. How can I resolve this issue so that my application can boot up? I've upgraded many rails applications but this is my first time with node/react and am facing many obstacles. I don't know what other context I can provide but this is my current issue and I would really appreciate the help. Thank you.

1

1 Answer

Delete node modules and clear the cache.

rm -rf node_modules && npm cache clean -f && npm install

If that does not work, try to delete the package-lock file.

rm -rf node_modules && package-lock.json && npm cache clean -f && npm install

Furthermore, you can also check the dependencies of packages using npm list

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Sarah Jenkins

Sarah Jenkins

Senior Technology Editor & AI Specialist

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.

Share this article
Twitter Facebook Pinterest