You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
filename option in vm.runInThisContext function argument disabled #2711
It works for me, are you sure you're using the right version of node.js/io.js?
> vm.runInThisContext('console.trace()', { filename: 'vmTest' })
Trace
at vmTest:1:9
at Object.exports.runInThisContext (vm.js:54:17)
at repl:1:4
at REPLServer.defaultEval (repl.js:164:27)
at bound (domain.js:250:14)
at REPLServer.runBound [as eval] (domain.js:263:12)
at REPLServer.<anonymous> (repl.js:392:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:210:10)
undefined
> vm.runInThisContext('console.trace()', 'vmTest');
Trace
at vmTest:1:9
at repl:1:4
at REPLServer.self.eval (repl.js:110:21)
at repl.js:249:20
at REPLServer.self.eval (repl.js:122:7)
at Interface.<anonymous> (repl.js:239:12)
at Interface.emit (events.js:95:17)
at Interface._onLine (readline.js:203:10)
at Interface._line (readline.js:532:8)
at Interface._ttyWrite (readline.js:761:14)
undefined
node v0.12+ is backwards compatible with the string argument. So you could just use that type of invocation if you need to also support v0.10.
Activity
mscdex commentedon Sep 5, 2015
It works for me, are you sure you're using the right version of node.js/io.js?
For example, on node v0.10, the second parameter is the
filenamestring directly instead of an options object:node v0.12+ is backwards compatible with the string argument. So you could just use that type of invocation if you need to also support v0.10.
freeneutron commentedon Sep 6, 2015
Excuse me. My node has a version 0.10.40. To install it, I use a simple script:
curl --silent --location https://rpm.nodesource.com/setup | bash -
yum -y install nodejs
Obtained at this link:
https://github.com/nodejs/node-v0.x-archive/wiki/Installing-Node.js-via-package-manager?utm_source=%5Bdeliciuos%5D&utm_medium=twitter#enterprise-linux-and-fedora
mscdex commentedon Sep 6, 2015
Ok, so then you will need to use the second solution instead:
vm.runInThisContext('console.trace()', 'vmTest');.Fishrock123 commentedon Sep 6, 2015
Sounds like this has been answered. Re-open if necessary.
freeneutron commentedon Sep 6, 2015
Yes. many thanks!