Any version of debug that I use past version 3.1.0 gives this error when trying to browserify code that includes this module
Cannot find module './common' from '[redacted]/node_modules/debug/dist'
at FSReqWrap.oncomplete (fs.js:154:21)
There was a mention in #603 about a browserify incompatibility, but it doesn't appear to be the same issue.
Hi - which version exactly is being pulled down?
Hi @Qix- , my team is experiencing the same exact issue. We are pulling v3.2.4
I get that same error with versions 3.2.3, 3.2.4, and 4.0.0
Interesting, I'll take a look - give me a moment.
To be clear, you shouldn't be pulling 3.2.x at all - should either be 3.1.0 or 4.0.0. the 3.2.x range was deprecated and only existed to help users affected at the time of the incident.
Pulling debug from npm should act as though the 3.2 range does not exist.
@Qix- maybe it is that we are using martifactory registry as a caching proxy in the middle which is not aware yet of that deprecation. I will look into that.
the same issue for me with [email protected]
Reason: Error: Cannot find module './common' from 'node_modules/debug/dist'
Does the code on unpkg match the code in the node_modules/debug/dist/debug.js folder?
https://unpkg.com/[email protected]/dist/debug.js
If so, then there's no reason this shouldn't work. This is the same invocation of browserify as before, just with babel thrown on to it (which shouldn't affect anything).
Could you also give more information as to how you're using debug? Some reproduction steps would help.


I can't help fix this without some reproduction steps. debug works in the browser for me.
Deep requiring into a specific file in the package from an unpkg url is not exactly a "works in the browser" test that feels like it was made in good faith. Here's a barebones "try debug with browserify" that breaks (assumes you have npm@6 so that npx is a command you can run):
$ npm init -y
$ npm install debug@latest browserify@latest
$ echo "var log = require('debug')('example')" >example.js
$ npx browserify example.js
Error: Cannot find module './common' from '/usr/local/src/gar/projects/example/node_modules/debug/dist'
at /usr/local/src/gar/projects/example/node_modules/browser-resolve/node_modules/resolve/lib/async.js:55:21
at load (/usr/local/src/gar/projects/example/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43)
at onex (/usr/local/src/gar/projects/example/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
at /usr/local/src/gar/projects/example/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47
at FSReqWrap.oncomplete (fs.js:154:21)
Deep requiring into a specific file in the package from an unpkg url is not exactly a "works in the browser" test that feels like it was made in good faith.
Feel free to submit a PR that automates this testing. The release wasn't made in "bad faith", if that's what you're suggesting. I'm one person managing a package that is downloaded several million times per day - all I can do is help fix problems where they arise.
The alternative is to not release ever again, which solves nothing.
Thank you for the reproduction steps - I can confirm they reproduce.
Unpkg uses the browser field, in my opinion, erroneously. They _do_ supply an unpkg field apparently.
I'll revert browser to src/browser.js and add "unpkg": "dist/debug.js". That should fix both cases.
PR incoming.
Some input on #607 would be appreciated. You can test this version by running npm i 'visionmedia/debug#fix-browserify'.
Could this be included in a 3.2.5 release? We are still getting 3.2.4 when using yarn
@gztomas sure.
Released as 4.0.1 and backported to 3.2.5.
Even though this issue is closed let me know _here_ if that doesn't solve it.
Working for us! Thanks for the awesome support!
No problem, thank you for following up @gztomas
Back in business, @Qix- ! Thanks for your hard work! I do not envy your position these past several hours. What a nightmare, but well met!
Thank you @ThomasGHenry, sorry for the trouble :)
Hi, I found this fix broke Angular/Webpack.
I am a user of aws-appsync. Since a recent release, the debug package is added to their dependencies.
However, IE11 no longer worked as Angular/Webpack utilized the browser property from debug's package.json when bundling.
https://github.com/awslabs/aws-mobile-appsync-sdk-js/issues/310
It worked immediately if I edited the file node_modules/aws-appsync/debug/package.json and turned browser back to "./dist/debug.js" as webpack used that file instead of src/browser.js for a browser.