Use npm >= 8 so I can install newer libraries

I’m building a svelte app, but when installing, I get this error:

npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: rollup@3.25.2
npm ERR! notsup Not compatible with your version of node/npm: rollup@3.25.2
npm ERR! notsup Required: {"node":">=14.18.0","npm":">=8.0.0"}
npm ERR! notsup Actual:   {"npm":"7.20.6","node":"v16.14.2"}

I’ve specified the node engine in package.json, and tried adding npm 9.8.1 to my dependencies, but glitch refuses to use npm over 7.20.6. Is there any way to make it use a more up-to-date version of npm?

in what way does it refuse to use a newer npm? does the new npm crash?

Even with npm 9.8.1 specified, and the latest version of node I can get it to use, it’s still using npm 7.20.6. I need at least 8.

I tried doing this in a new project and it seems to start using the newer npm

diff from glitch-hello-node:

diff --git a/package.json b/package.json
index 214e1a8..fcd0fcc 100644
--- a/package.json
+++ b/package.json
@@ -9,12 +9,13 @@
   "dependencies": {
     "fastify": "^4.21.0",
     "handlebars": "^4.7.8",
+    "npm": "^9.8.1",
     "@fastify/formbody": "^7.4.0",
     "@fastify/static": "^6.10.2",
     "@fastify/view": "^8.0.0"
   "engines": {
-    "node": "14.x"
+    "node": "16.x"
   "repository": {
     "url": "!/glitch-hello-node"
@@ -24,4 +25,4 @@
\ No newline at end of file

from project logs:

node v16.14.2, npm 9.8.1
npm WARN reify Removing non-directory /app/node_modules
added 111 packages, and audited 360 packages in 19s
33 packages are looking for funding
  run `npm fund` for details
found 0 vulnerabilities
Total install time: 22353ms

🔂🎷 Your app is listening on

although that “reify Removing non-directory /app/node_modules” looks pretty troubling

edit: to clarify, npm 7.x runs again to install npm 9.x, then later installs happen from npm 9.x . that’s not good for automatic project startup :skull:

1 Like

Thanks for that final clarification. That did it. I removed all dependencies from my package.json, except for `“npm”: “^9.8.1”, let it auto-install, then added them back in. From then on, it used npm 9.8.1.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.