Cannot read property 'hex' of undefined (only with v2.3.0)
See original GitHub issueHi,
I use chalk
to add colors to console logs in a personal project (create-cozy-app) and thanks a lot for your great job on this module 👍
But something seems broken since the version 2.3.0. I use almost only the chalk.hex()
method and I got this issue:
myapptest/node_modules/cozy-scripts/node_modules/chalk/index.js:82
const open = ansiStyles.color[levelMapping[level]][model].apply(null, arguments);
^
TypeError: Cannot read property 'hex' of undefined
at Function.<anonymous> (myapptest/node_modules/cozy-scripts/node_modules/chalk/index.js:82:55)
at Object.<anonymous> (myapptest/node_modules/cozy-scripts/utils/_colorize.js:7:15)
at Module._compile (module.js:643:30)
at Object.Module._extensions..js (module.js:654:10)
at Module.load (module.js:556:32)
at tryModuleLoad (module.js:499:12)
at Function.Module._load (module.js:491:3)
at Module.require (module.js:587:17)
at require (internal/module.js:11:18)
All work well with the version 2.2.2 but also if I only use default colors (chalk.blue()
, chalk.bgWhite()
). And it seems to concern only my webpack usage like here or here.
I suppose that came from this commit so: https://github.com/chalk/chalk/commit/7be154c074026f77b99e7d854b3a4cdd5e4ae502
Hope that will help.
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Javascript Error: Uncaught TypeError: Cannot read property ...
First, you need to run your script after the entire DOM has loaded. If you run your script before the DOM has fully...
Read more >How to Read React Errors (fix 'Cannot read property of ...
Cannot read property means the code was trying to read a property. This is a good clue! There are only a few ways...
Read more >cannot read properties of undefined (reading 'icon') - You.com
Here the error is coming from line 2: value: {Icon, name, level} . The value coming via props seems to be undefined. Check...
Read more >Crypto | Node.js v19.3.0 Documentation
The node:crypto module provides cryptographic functionality that includes a set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify ...
Read more >ThemeData class - material library - Flutter - Dart API docs
These properties are guaranteed to have non-null values. The static Theme.of ... 'This feature was deprecated after v2.3.0-0.1.pre. ... read-onlyoverride.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks to @partheseas’s work mentioned in #224, I was able to distill out an even better demonstration. It’s not constructor-vs-not (that was a red herring) but rather what level is enabled:
This example works, except for the last line, which fails per the original description of this bug.
Oh, my apologies. I thought it went to 4. (By way of suggestion, maybe the constructor should throw if given a bogus level.)