When I type npm start
I get this error:
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v21.2.0
But when I type node -v
I get 20.9.0
I tried checking whether Node.js v21.2.0 exists. But no. Its added to PATH and everything but it still doesnt seem to work
If you want to keep using a newer version of Node, you can use
export NODE_OPTIONS=--openssl-legacy-provider
and then run Node as normal. This is not hugely recommended but will work.https://openjsf.org/blog/node-js-17-is-here
I believe this started from Node 17 onwards so another workaround would be to use an older version of Node than that, e.g. 16 but again this would not be hugely recommended.
Otherwise, you need to upgrade NPM and all packages you are using to versions that support OpenSSL v3. You can do this with
npm audit fix --force
but this may well break your build so it probably makes more sense to go through your packages manually and just update them to the latest versions that you can along with removing any that you don’t need. Most packages have long since been updated to support OpenSSL v3.