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

TypeError: eval is not a function #30

Closed
jaruba opened this issue Oct 12, 2018 · 8 comments
Closed

TypeError: eval is not a function #30

jaruba opened this issue Oct 12, 2018 · 8 comments
Labels

Comments

@jaruba
Copy link

jaruba commented Oct 12, 2018

Recently my app keeps exploding because of this error from depd:

./node_modules/depd/index.js:410
  var deprecatedfn = eval('(function (' + args + ') {\n' +
                     ^

TypeError: eval is not a function

I think node.js removed eval() completely in favor of VM: https://nodejs.org/api/vm.html

depd is a dep of a lot of modules in my case: express, http-errors, send and body-parser

So, my question is why is depd v2.x not being released already to solve this mayhem properly?

@dougwilson
Copy link
Owner

The eval function is still a part of Node.js.

@jaruba
Copy link
Author

jaruba commented Oct 12, 2018

Then why am I getting this error on app start on 2 different computers, with 2 different Node.js versions?

In the current case I'm using: Node.js v8.11.4 (latest LTS on their site is v8.12.0)

I'm not using Electron, NW.js or anything else, just Node.js

@jaruba
Copy link
Author

jaruba commented Oct 12, 2018

Also, I had no problems in the past, this started happening recently.

@dougwilson
Copy link
Owner

I'm not sure. I just tried it out and the function is there still for me:

$ node -e 'console.log(process.version);console.log(typeof eval);console.log(eval("4 + 1"))'
v8.11.4
function
5

and

$ node -e 'console.log(process.version);console.log(typeof eval);console.log(eval("4 + 1"))'
v8.12.0
function
5

Perhaps if you can provide the full steps to reproduce on my end I can help determine why you're having the issue, but without any steps to reproduce, you'll likely need to debug through it or open an issue on the Node.js repo if your binaries are missing a core function.

@dougwilson
Copy link
Owner

One would also think that your report wouldn't be the first and only one (https://github.com/dougwilson/nodejs-depd/issues?utf8=%E2%9C%93&q=is:issue+%22eval+is+not+a+function%22) if eval was really removed from Node.js with this module being in things like express, no? 8.11.4 was released Aug 16, so it seems like someone else would have upgraded to that version of Node.js by now and reported the same issue?

@jaruba
Copy link
Author

jaruba commented Oct 12, 2018

This is indeed very strange, your terminal command works for me too:

$ node -e 'console.log(process.version);console.log(typeof eval);console.log(eval("4 + 1"))'
v8.11.4
function
5

But I can't imagine how that error could mean anything else, or be caused by anything else.

I'll try to make a simplistic test case to see if it's reproducible on a small scale, otherwise it may be that my app is somehow breaking it, although i can't currently comprehend how it could break eval like this.

@jaruba
Copy link
Author

jaruba commented Oct 12, 2018

holy mother of god, i debugged it and found the issue, thanks for taking the time to put me straight

for your enjoyment, i was using a deobfuscation script found online, which after reading it thoroughly, it does, and I quote:

eval = window.eval = write = document.write = writeln = document.writeln = createPopup = window.createPopup = createElement = document.createElement = appendChild = beautify

jesus christ..

it's annoying that it proved itself to be the best deobfuscation script out there

@dougwilson
Copy link
Owner

What the what? That is pretty mind blowing. I'm glad you found the issue. I would have been happy to re-open if there was something we had to change to fix something, of course 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants