felixge / node-sandboxed-module

A sandboxed node.js module loader that lets you inject dependencies into your modules.
MIT License
342 stars 42 forks source link

json3 dosn't run in VM #55

Open mStirner opened 8 years ago

mStirner commented 8 years ago

Hay, i have a little problem.

I cant use json3 (socket.io, btw. socket.io-client) inside the node js VM. When i run it i become this error: "TypeError: Cannot read property 'prototype' of undefined" (https://github.com/bestiejs/json3)

/home/marc/NetBeansProjects/Project/node_modules/socket.io-client/node_modules/json3/lib/json3.js:50 var objectProto = Object.prototype, ^ TypeError: Cannot read property 'prototype' of undefined at runInContext (/home/marc/NetBeansProjects/Project/node_modules/socket.io-client/node_modules/json3/lib/json3.js:50:29)

See other issue on: https://github.com/socketio/socket.io/issues/2381#issuecomment-172353479

chge commented 7 years ago

node-sandboxed-module improperly defines global.global !== global, so json3 fails to determine proper root (see #61).