New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to make existing processes use new version of Node? #4430
Comments
Hi folks, hoping to migrate from Node 8 to Node 10, anyone care to comment? |
You can try |
@vicatcu , any solution? |
tl;drIf you are managing the Node.js versions using Volta: # Apps Only
volta install node@lts
volta install pnpm@latest
pm2 update If you are managing the Node.js versions using pnpm: # Apps Only
pm2 update
# Apps and Daemon
pm2 kill
pnpm env use latest -g # Change the active Node.js version
pnpm add pm2@latest -g # Reinstall the PM2 package globally
pm2 Apps Only
Reproduction using node -v # v20.8.1
&& pm2 start index.js --no-autorestart
&& pm2 info 0 # node.js version 20.8.1
&& pnpm env use latest --global
&& node -v # v21.0.0
&& pm2 update # >>>>>>>>>> PM2 updated
&& pm2 info 0 # node.js version 21.0.0 // index.js
console.log(new Date().toISOString());
console.log(process.version);
setInterval(() => {}, 60 * 1000);
Apps and Daemon
# Reference ~/.pm2/pm2.log to check which Node.js version is used.
rm -rf ~/.pm2
# Use Node.js 20.10.0
pnpm env use lts --global
pm2 # 20.10.0 is used
pm2 kill
# Use Node.js 21.2.0
pnpm env use latest --global
pm2 # 21.2.0 is used
pnpm users should reinstall PM2 globally after switching the Node.js version. # This error occurs if the original Node.js version is uninstalled.
pm2
# /Users/~/Library/pnpm/pm2: line 13:
# /Users/~/Library/pnpm/nodejs/20.10.0/bin/node: No such file or directory # Reference ~/.pm2/pm2.log to check which Node.js version is used.
rm -rf ~/.pm2
# Use Node.js 20.10.0
pnpm env use lts --global
pnpm add pm2@latest -g # IMPORTANT
pm2 # 20.10.0 is used
pm2 kill
# Use Node.js 21.2.0
pnpm env use latest --global
pnpm add pm2@latest -g # IMPORTANT
pm2 # 21.2.0 is used
pm2 kill
# Remove Node.js 20.10.0
pnpm env rm lts --global
pm2 # Works |
What's going wrong?
I have an existing set of process running in pm2 using NVM and Node 8.
I do the following set of steps to update my situation to Node 10.
I feel like that should be enough to express my intent. And indeed it mostly seems to do the trick. However, the output of
pm2 info some-process
still indicatesnode.js version: 8.9.4
, and the PATH environment variable reported there also clearly includes the NVM directory for node 8.9.4 binaries.Obviously, I can
pm2 delete some-process
, and then re-do thepm2 start ... --name some-process
incantation that I did in the first place, but I have to believe that there is some way for me to ask PM2 nicely to do this for me with a CLI command. Am I right?How could we reproduce this issue?
Supporting information
pm2 doesn't say anything useful, indicates Node 10 is in use everywhere.
The text was updated successfully, but these errors were encountered: