Home > Back-end >  How can I install anything using npm if everything yields the same error?
How can I install anything using npm if everything yields the same error?

Time:01-11

Any time I try to install anything via npm, I get this warning:

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '[email protected]',
npm WARN EBADENGINE   required: { node: '0.8.x || 0.10.x' },
npm WARN EBADENGINE   current: { node: 'v16.15.1', npm: '8.11.0' }
npm WARN EBADENGINE }

followed by this error (among several other less informative errors)

npm ERR! code 1
npm ERR! path /home/ubuntu/projects/GitHub/AWCPT/opentrees-data/node_modules/mbtiles/node_modules/sqlite3
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build

This includes npm install, npm install colors, npm install sqlite3, and npm install tiletype. How do I fix this?

CodePudding user response:

There is clearly something wrong with the tiletype package. It requires node v0.8.x or 0.10.x, while you're running v16.15.1. On top of that, tiletype v0.1.0 is discontinued for quite a while.

Perhaps, deleting the node_modules folder and reinstalling all packages from scratch (npm i) would fix it.

If not, check where this package comes from. Is it in your package.json or is is installed as a dependency for another package?

CodePudding user response:

Use nvm to switch to older version of node.

nvm install v0.10
nvm use v0.10

Delete node modules folder and install npm packages again

npm install
  • Related