-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
console.error is not a function #4467
Comments
Same error does not occur using the repl:
|
Reproduces with: const EventEmitter = require('events');
EventEmitter.defaultMaxListeners = 1;
console.error('');
So this seems kind of expected. |
if there's no global console cached, these calls will initialize it, which in some cases can cause a circular dependency, making the console received here an empty object. The program shouldn't crash in this case. Fixes nodejs#4467
So, node sets up the global objects e.g.
. The second one of these wants to trigger another warning about max listeners detected, so it has to initialize the global There's no problem in the REPL because I propose a fix at #4479. |
If there's no global console cached, initialize it. Fixes: nodejs#4467 PR-URL: nodejs#4479 Reviewed-By: Roman Reiss <me@silverwind.io> Reviewed-By: James M Snell <jasnell@gmail.com>
Using 4.2.4 on OSX (not sure if this appears anywhere else yet).
Script: test.js
Output:
The text was updated successfully, but these errors were encountered: