1

Since installing bun on my Windows 11 pc and using node.js with npm for a several years, all of the npm functionality have crashed such as npm start and npm create in react.js and react-native. Also running bun crashes such as bun create or bun start. In the Windows command line, I get this error in all cases:

error: could not create process

Bun failed to remap this bin to its proper location within node_modules. This is an indication of a corrupted node_modules directory.

Please run 'bun install --force' in the project root and try it again. If this message persists, please open an issue: https://github.com/oven-sh/bun/issues

As a result, the react and node.js apps do not work or cannot create new apps. Current versions: Node: v22.18.0, NPM v11.5.2 and Bun: 1.2.21

Anyone knows the issue or a fix?

I have tried re-installng Node, NPM and Removing Bun. Also reordering the System environment variable for Node and Bun. Individual projects like React deleting node modules and using npm install

1 Answer 1

0

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.

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
Sign up to request clarification or add additional context in comments.

4 Comments

The problem comes from Bun taking over your PATH. After you installed it, when you type npm or npx in the terminal, Windows is actually running Bun’s wrapper instead of Node’s real npm, and that’s what gives you the “remap” error. The quick fix is to check which one is being used: where node where npm where npx where bun
Ok the check showed: Node used in sys env path, Bun & npm in user env path. Would I need to reorder the Env vars Paths to npm and bun or simply remove the bun env global path?
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.
I can't give you the exact paths, but if you write them down, I'll include the full command in my answer. I use Node.js and Bun by MISE version manager.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.