Registry / devops / browserify

browserify

JSON →
library17.0.1jsnpmunverified

Browserify is a JavaScript bundler that enables developers to use Node.js-style `require()` statements in client-side browser code. It recursively analyzes the `require()` calls in an application to build a single JavaScript bundle that can be served to the browser. As of April 2026, the current stable version is 17.0.1, with releases occurring periodically to address dependency updates and bug fixes, rather than a strict time-based cadence. Its key differentiator is its adherence to the CommonJS module system for the browser, allowing direct reuse of many npm modules originally written for Node.js, offering an alternative to modern ESM-focused bundlers like Webpack or Rollup for projects that prefer or are built around the CommonJS paradigm. It handles core Node.js built-in modules by providing browser-compatible polyfills.

npm install browserify
INSTALL
IMPORT
SIG · BROWSERIFY
B
browserify
devopsjavascriptv17.0.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

browserify CLI
npx browserify main.js -o bundle.js
browserify main.js > bundle.js (if not globally installed)
Most common usage is via the command line. `npx` ensures using the locally installed version. Global installation (`npm install -g browserify`) allows direct `browserify` command.
browserify (programmatic)
const browserify = require('browserify');
import browserify from 'browserify';
Browserify is primarily a CommonJS module, reflecting its origins and Node.js-centric nature. While Node.js supports ESM, Browserify itself is best consumed via `require()` in build scripts.
Transform API
b.transform(require('some-transform'));
b.transform('some-transform'); (without require/import)
Transforms (like `envify`, `babelify`) are applied to modules. When used programmatically, transforms are typically `require`d and passed as functions or strings.

This quickstart demonstrates programmatically bundling a simple application with `browserify`, showing how it resolves internal `require()` calls and outputs a single JavaScript file. It creates hypothetical module files and then bundles `main.js` into `bundle.js`.

const fs = require('fs'); const browserify = require('browserify'); // main.js - This would typically be a separate file const mainJsContent = ` var foo = require('./foo.js'); var bar = require('../lib/bar.js'); var gamma = require('gamma'); // Assuming 'gamma' is an npm package var elem = { textContent: '' }; // Mock document.getElementById('result') for Node.js context // In a real browser, this would be: var elem = document.getElementById('result'); var x = foo(100) + bar('baz'); elem.textContent = gamma(x); console.log('Result:', elem.textContent); `; // foo.js - Another module const fooJsContent = ` module.exports = function (n) { return n * 111; }; `; // lib/bar.js - Another module in a subdirectory const barJsContent = ` module.exports = function (s) { return s.length; }; `; // Create dummy files for the example to run fs.writeFileSync('main.js', mainJsContent); fs.writeFileSync('foo.js', fooJsContent); fs.writeFileSync('lib', '', { flag: 'wx' }, (err) => { if (err && err.code !== 'EEXIST') throw err; fs.writeFileSync('lib/bar.js', barJsContent); }); const b = browserify('./main.js', { // Optionally include source maps for debugging debug: true }); // You might add transforms here, e.g., b.transform('babelify'); b.bundle((err, buf) => { if (err) { console.error('Browserify error:', err); return; } console.log('Bundle created successfully! Writing to bundle.js'); fs.writeFileSync('bundle.js', buf.toString()); console.log('To run this bundle in a browser: <script src="bundle.js"></script>'); // Cleanup dummy files (optional) fs.unlinkSync('main.js'); fs.unlinkSync('foo.js'); fs.unlinkSync('lib/bar.js'); fs.rmdirSync('lib'); });
browserify --version
Debug
Known issues
breakingMajor internal dependency upgrades in v17.0.0 changed underlying APIs for 'events', 'path-browserify', and 'stream-browserify'. Projects relying on deeply introspecting or extending these polyfills might experience issues. Specifically, `EventEmitter` instances now have an `off()` method, and `require('stream')` matches Node.js 10+ API.
fix
Review any custom logic interacting with `EventEmitter` or `stream` polyfills. Update code to be compatible with Node.js 10+ stream API or `events` v3.x.
affects: >=17.0.0
breakingThe `stream-http` dependency, upgraded in v16.4.0, dropped support for Internet Explorer 10 and below. Applications targeting these legacy browsers will no longer function correctly if they rely on `http` or `https` browser polyfills provided by Browserify.
fix
If IE10 or older browser support is critical, either pin Browserify to a version prior to 16.4.0 (e.g., 16.3.0) or implement custom polyfills/workarounds for HTTP/HTTPS functionality for those specific environments.
affects: >=16.4.0
gotchaUsing the `--noparse` option (or `options.noparse` programmatically) prevents Browserify from parsing the specified files. While this can significantly speed up builds for large libraries (e.g., jQuery), it also means that any `require()` calls *within* those `noparse`d files will *not* be resolved or bundled by Browserify, potentially leading to runtime errors if those dependencies are not externally provided.
fix
Only use `--noparse` for files that are truly self-contained or explicitly global, and do not contain internal `require()` statements that Browserify needs to resolve. Verify that all dependencies of `noparse`d files are either globally available or included through other means.
affects: >=1.0.0
gotchaBrowserify's support for Node.js 0.8 (as indicated in older version dependencies) means it prioritizes broad compatibility over the latest Node.js features. While it polyfills many Node.js built-ins for the browser, users expecting behavior or APIs from very recent Node.js versions might find discrepancies or missing features in the polyfilled modules.
fix
Be aware that Browserify's polyfills aim for a baseline compatibility. For specific, cutting-edge Node.js API features, consider if a custom polyfill or an alternative bundling approach is necessary. Always test your bundled code thoroughly in target browser environments.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'some-module'
A `require()` statement refers to a module that Browserify cannot locate in `node_modules` or via a relative path.
fix
Ensure the module is installed (e.g., `npm install some-module`) and correctly referenced with its package name or a valid relative/absolute path. Check for typos in the `require()` path.
ReferenceError: process is not defined
Code expects the Node.js `process` global to be available in the browser, but Browserify's global detection or insertion was not enabled or overridden.
fix
Use the `--insert-globals` (`--ig`) or `--detect-globals` (`--dg`) options when bundling via CLI, or `insertGlobals: true` / `detectGlobals: true` in programmatic options, to ensure Browserify adds polyfills for Node.js globals like `process`.
ReferenceError: Buffer is not defined
Similar to `process`, code relies on the Node.js `Buffer` global without it being polyfilled or detected by Browserify.
fix
Ensure global insertion or detection is enabled via `--insert-globals` / `--detect-globals` CLI options or programmatic `insertGlobals: true` / `detectGlobals: true` options. Browserify's default behavior usually includes `Buffer` polyfills, so check if any transforms or configurations are interfering.
browserify: command not found
The `browserify` executable is not in the system's PATH, typically because it was not installed globally or `npx` was not used for a local installation.
fix
If installed locally in a project, use `npx browserify` (recommended). To make `browserify` available globally, run `npm install -g browserify`.
Upgrade
Version history
17.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
browserify — npm install browserify · libregistry