Skip to content
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

babel-node: this.log is not a function #20

Closed
JamieMagee opened this issue Mar 19, 2020 · 3 comments
Closed

babel-node: this.log is not a function #20

JamieMagee opened this issue Mar 19, 2020 · 3 comments

Comments

@JamieMagee
Copy link

I'm trying to add njsTrace to Renovate. It works fine when running with nodejs, but when using babel-node, which we use for debugging, I get the following stacktrace:

TypeError: this.log is not a function
    at NJSTrace.inject (/home/jamie/code/renovate/node_modules/njstrace/njsTrace.js:73:7)
    at levels (/home/jamie/code/renovate/lib/logger/index.ts:129:5)
    at Object.parseConfigs (/home/jamie/code/renovate/lib/config/index.ts:70:3)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
    at Object.<anonymous> (/home/jamie/code/renovate/node_modules/@babel/node/lib/_babel-node.js:180:21)
    at Module._compile (internal/modules/cjs/loader.js:775:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3

Here's my PR so far renovatebot/renovate#5632.

Any suggestions or help would be greatly appreciated.

@ValYouW
Copy link
Owner

ValYouW commented Mar 19, 2020

Does babel-node compiles the code? you will have to see what's the actual output that is being run in order to see why... log is a prototype function of NJSTrace and there is no reason for it not to be on this...

@JamieMagee
Copy link
Author

Yes. It's effectively a wrapper around Node.js, with the benefit of compiling babel presets and plugins.

Any idea how I can inspect the output?

@ValYouW
Copy link
Owner

ValYouW commented Mar 19, 2020

Never worked with it, maybe if you can run it in debugger you'll see the code(?)
You can edit node_modules/njstrace/njsTrace.js and insert a debugger; command to trigger a breakpoint where you want (I would say line 72 which is before the crash)...

@ValYouW ValYouW closed this as completed Feb 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants