Debug: exports.useColors is not a function

Created on 19 Dec 2016  Â·  16Comments  Â·  Source: visionmedia/debug

Everything was working fine Friday. Had to reinstall fresh all my npm packages this morning, and I got this error in my webpack-dev-server

As I didn't change anything to my package.json (and I'm not using directly debug) I suspect an update in the last days broke things.
The only package I have using the most recent debug version is [email protected] (-> [email protected])

My [email protected] and [email protected] use [email protected]

I have no idea how to solve this issue right now, so if someone has clues I'd be happy to help

image

Extract of debug.js causing the problem :

image

Most helpful comment

@DaveGee For posterity, I'm curious as to what your webpack.config.js file looks like.

All 16 comments

For now I had to npm shrinkwrap and fix the version number of debug to 2.3.0 for my build to work again.
There was also superagent, eslint and other packages that were using debug > 2.2.0

Interesting. Will look into this tonight. We need more test coverage if anyone is willing to put in PRs

^if that is the solution, I am wondering how you imported debug?

I am not using debug directly. it's a dependency of packages I use (babel, eslint, superagent, and probably others)
As I have no control on this packages' own packages.json, "shrinkwrapping" is the only "solution" I found to workaround the issue

It looks like bower.json was referencing the wrong file. Wondering if you had this installed via bower @DaveGee ?

I do not use bower. I have not installed or referenced debug in my project, neither using bower, neither using npm. debug is a dependency of packages I use (I can provide you the list, or even my package.json)
So when I build my application with webpack, debug ends up in my code because of npm's dependency hell somehow

@DaveGee see my link above: https://github.com/visionmedia/debug/issues/371#issuecomment-267526469

@DaveGee Maybe it's relevant with your webpack configuration

@DaveGee If you have the following line in your webpack config, bower.json needs to be changed to .bower.json.

new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin('bower.json', ['main'])

Otherwise, updating to the latest version of debug should fix the issue. The bower.json entrypoint was pointing to debug.js, which when installed with npm was the wrong file. In the new version, bower.json correctly points to src/browser.js.

This is insane. Adding the lines about bower.json in the config of webpack solves the issue apparently, although I repeat : I do not use bower, and have no bower.json, nor .bower.json file anywhere in my own code

So I must add a config line about a tool I don't use for my code to work. Anyone has an explanation about this ?

Thanks for your help

I'll look more into this, as I won't let my config files get messy with unrelated stuff. I think I prefer the shrinkwrap way

It was a suggestion if you had that line in your webpack config. There are other possibilities and I could help you troubleshoot, but the easiest solution is to try 2.5.1 which was released today.

On 21 Dec 2016, at 7:15 pm, David Geretti notifications@github.com wrote:

This is insane. Adding the lines about bower.json in the config of webpack solves the issue apparently, although I repeat : I do not use bower, and have no bower.json, nor .bower.json file anywhere in my own code

So I must add a config line about a tool I don't use for my code to work. Anyone has an explanation about this ?

Thanks for your help

I'll look more into this, as I won't let my config files get messy with unrelated stuff. I think I prefer the shrinkwrap way

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

No problem. I'll try to update my modules today and keep you updated. Thanks

Apparently the new release (2.5.1) solves the issue!
Thanks!

@DaveGee For posterity, I'm curious as to what your webpack.config.js file looks like.

The users of my library have a similar problem after they upgrade from 2.3.3: https://github.com/tachyons-css/react-native-style-tachyons/issues/26

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Qix- picture Qix-  Â·  7Comments

jfoclpf picture jfoclpf  Â·  6Comments

dave-ops picture dave-ops  Â·  6Comments

BertCatsburg picture BertCatsburg  Â·  5Comments

ArvoGuo picture ArvoGuo  Â·  5Comments