npm Package Not Working in Bolt.new
Quick Answer
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.
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.
Related fixes
Weekly Newsletter
Get next week's fix before you need it.
Join developers getting weekly vibe coding tips, error fixes, and tool updates.
Subscribe on Substack →