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.
Bolt reviews
Open this when the prototype came fast but the rebuild cost is starting to show up in auth, deploy, or state problems.
Open this next →
Bolt vs v0
Open this when the real decision is whether you still need a browser-first prototype tool or a stronger frontend base.
Open this next →
Fillout vs Typeform
Open this when forms, onboarding, intake, or checkout are the next workflow layer breaking after the app shell is already in place.
Open this next →
Deploy hub
Open this when the build error is one symptom and the bigger problem is your production handoff and hosting workflow.
Open this next →
Cursor review
Open this when deploy pain is pushing you toward a more code-first workflow with tighter control.
Open this next →
Quick Fix Summary
| Most likely cause | Bolt runs in WebContainers — a browser-based Node.js environment. Packages that require native compilation (C++ addons) cannot run here. |
| Fastest fix | Replace native packages with JS alternatives |
| Use this page if | npm 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
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.