Bolt·Fixdeployintermediate

npm Package Not Working in Bolt.new

Quick Answer

How do I fix npm Package Not Working in Bolt.new?

Bolt runs in WebContainers — a browser-based Node.js environment. Packages that require native compilation (C++ addons) cannot run here. Start with "Replace native packages with JS alternatives" before making broader code changes.

Fix signals

What this answers
Why npm package not working in bolt.new happens and what to change first.
Fastest move
Replace native packages with JS alternatives
Use this page if
npm install fails with compile errors

If this keeps happening

Open the next decision, not just the patch

Use these when the current fix is helpful, but the real answer is a better tool choice, a cleaner workflow layer, or a more trustworthy launch path.

Quick Fix Summary

Most likely causeBolt runs in WebContainers — a browser-based Node.js environment. Packages that require native compilation (C++ addons) cannot run here.
Fastest fixReplace native packages with JS alternatives
Use this page ifnpm install fails with compile errors

You're in the right place if...

  • !npm install fails with compile errors
  • !Package works locally but not in Bolt
  • !Error: Cannot find module with native addon

Why this happens

Bolt runs in WebContainers — a browser-based Node.js environment. Packages that require native compilation (C++ addons) cannot run here.

Fix

1

Replace native packages with JS alternatives

These common packages fail in Bolt. Use the alternatives instead:

# These FAIL in Bolt.new:
bcrypt → use bcryptjs instead
sharp → use Cloudinary API instead
canvas → use fabric.js instead
sqlite3 → use Supabase instead

# Install the replacement:
npm install bcryptjs

Prevent this next time

Before using any npm package in Bolt, check if it has native dependencies. Pure JavaScript packages always work.

Frequently Asked Questions

Check the package's GitHub repo for .gyp files or a binding.gyp file. These indicate native compilation requirements.

Yes, same API. bcryptjs is a pure JavaScript implementation — slightly slower but works everywhere including Bolt.

Related fixes