json3 icon indicating copy to clipboard operation
json3 copied to clipboard

json3 dosn't run in VM

Open mStirner opened this issue 9 years ago • 5 comments

Hay, i have a little problem.

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

/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)

As VM i use the module "sandboxed-module" (https://github.com/felixge/node-sandboxed-module)

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

mStirner avatar Jan 18 '16 18:01 mStirner

I'm hitting the same issue in a WebWorker in an iOS webview

dozoisch avatar Apr 21 '16 06:04 dozoisch

+1

GeoffreyPlitt avatar Sep 13 '16 19:09 GeoffreyPlitt

It's sandboxed-module issue.

chge avatar Sep 26 '16 13:09 chge

Same issue when importing json3 in a web worker using parcel.

raine avatar Dec 31 '18 15:12 raine

The same problem,in Electron,use SocketIO through webWorker,:

import { BitcoreBlockchain } from 'hd-wallet'

import SocketWorker from 'worker-loader?name=js/socketio-worker.[hash].js!hd-wallet/lib/socketio-worker/inside'

const blockchain = new BitcoreBlockchain(['https://btc4.trezor.io'], () => new SocketWorker())

_20190131120200

https://github.com/trezor/hd-wallet

Solution: nodeIntegrationInWorker: true

https://github.com/electron/electron/blob/master/docs/tutorial/multithreading.md

webees avatar Jan 31 '19 04:01 webees