Bun creates symlinks for the npm and npx commands (by specific PATH value), so when you try to access them globally, you end up invoking Bun's symlinks, and Bun is launched.
which npm
which npx
When editing the PATH key in the list of environment variables, move the Node.js and npm paths above bun. This way, when you type the npm or npx commands, Windows will stop at the first match in the PATH and execute it, meaning the original npm and npx will run.
Alternative
Uninstall Node.js (or nvm) and Bun from your system. Then install the mise version manager. After that, use mise to install the required versions of Node.js and Bun. You can customize these per project, or set global default versions.
- https://mise.jdx.dev/getting-started.html
- https://mise.jdx.dev/lang/node.html#node
- https://mise.jdx.dev/lang/bun.html#bun
winget install jdx.mise
mise use -g node@22
mise use -g bun@latest
Note: Avoid using bun upgrade to upgrade bun as mise will not be aware of the change.
mise upgrade
For a major version upgrade, of course, you'll need to install it manually again. But if you use the latest keyword, mise will take care of that automatically.
mise use -g node@24
mise use -g bun@latest