Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

json3 dosn't run in VM #86

Open
mStirner opened this issue Jan 18, 2016 · 5 comments
Open

json3 dosn't run in VM #86

mStirner opened this issue Jan 18, 2016 · 5 comments

Comments

@mStirner
Copy link

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: socketio/socket.io#2381 (comment)

@dozoisch
Copy link

dozoisch commented Apr 21, 2016

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

@GeoffreyPlitt
Copy link

+1

@chge
Copy link

chge commented Sep 26, 2016

It's sandboxed-module issue.

@raine
Copy link

raine commented Dec 31, 2018

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

@webees
Copy link

webees commented Jan 31, 2019

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

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

No branches or pull requests

6 participants