verdaccio: nodejs 22.0.0 and `npm login` fails
Your Environment
- verdaccio version: 5.30.3
- node version 22.0.0
- package manager: yarn@1
- os: Ubuntu 22.04
- platform: VM
Describe the bug
Running the Verdaccio server with Node.js 21 doing a npm login from the client works fine. Running Verdaccio with Node.js 22.0.0 gets a server side error and the process exits.
To Reproduce
Run the server with Node.js 22. On the client, run npm login.
fatal--- uncaught exception, please report this
TypeError: (0 , _crypto.createCipher) is not a function
at aesEncryptDeprecated (/var/lib/verdaccio/deployment/node_modules/@verdaccio/signature/build/legacy-signature/index.js:26:38)
at Auth.aesEncrypt (/var/lib/verdaccio/deployment/node_modules/verdaccio/build/lib/auth.js:479:48)
at jwt.jwt (/var/lib/verdaccio/deployment/node_modules/verdaccio/build/lib/auth-utils.js:126:20)
at new Promise (<anonymous>)
at getApiToken (/var/lib/verdaccio/deployment/node_modules/verdaccio/build/lib/auth-utils.js:125:18)
at callbackAuthenticate (/var/lib/verdaccio/deployment/node_modules/verdaccio/build/api/endpoint/api/user.js:42:56)
at /var/lib/verdaccio/deployment/node_modules/verdaccio/build/lib/auth.js:129:18
at /var/lib/verdaccio/deployment/node_modules/verdaccio-htpasswd/build/htpasswd.js:122:14
verdaccio@orca6:~/deployment$
Expected behavior
The server to continue running.
Environment information
System:
OS: Linux 6.5 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
CPU: (4) x64 DO-Regular
Binaries:
npm: 10.5.2 - /opt/amd64-linux/nodejs-22/bin/npm
Contribute to Verdaccio
- I’m willing to fix this bug 🥇
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 22 (11 by maintainers)
For those who still facing this issue on latest environment:
Please check https://verdaccio.org/docs/configuration/#how-to-the-token-is-generated and just make the secret 32 characters long in your (verdaccio storage)/.verdaccio-db.json
Thanks for releasing it, it all worked for me!
After upgrading to node 22+, I was also getting the same error.
On macos I just deleted the verdaccio folder in
~.After this it started fine.
The Stack Overflow author also wrote this:
You could generate new tokens for new logins with the newer functions and fallback to trying to read the token with this code if that fails and telling people they need to regenerate tokens if the fallback is needed. Then give users N months before the fallback code is deleted.
can you put a version identifier in the front of the token to support versioning?
I found this to create a backward compatible solution using
createDecipherivand evp_bytestokey. Could be another option.