petethepig/devtools-terminal

sudo devtools-terminal --install gives error

bsr203 opened this issue · 3 comments

sudo devtools-terminal --install                                                                                                                           ⏎ master ✱
/usr/local/lib/node_modules/devtools-terminal/node_modules/socket.io/lib/store.js:35
Store.prototype.__proto__ = EventEmitter.prototype;
                                        ^

TypeError: Cannot read property 'prototype' of undefined
    at Object.<anonymous> (/usr/local/lib/node_modules/devtools-terminal/node_modules/socket.io/lib/store.js:35:41)
    at Module._compile (module.js:573:32)
    at Object.Module._extensions..js (module.js:582:10)
    at Module.load (module.js:490:32)
    at tryModuleLoad (module.js:449:12)
    at Function.Module._load (module.js:441:3)
    at Module.require (module.js:500:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/devtools-terminal/node_modules/socket.io/lib/manager.js:16:13)
    at Module._compile (module.js:573:32)

node --version master ✱
v7.0.0

OS X 10.9.5

npm install -g devtools-terminal ⏎ master ✱
/usr/local/bin/devtools-terminal -> /usr/local/lib/node_modules/devtools-terminal/bin/devtools-terminal
/usr/local/lib
└── devtools-terminal@0.1.3

Edit:

from this , it could be an issue with dependencies with node v7.

jchv commented

It seems Node v7 finally removes process.EventEmitter. Practically speaking this means that Socket.IO 0.9.x no longer works. The correct solution, at least in my mind, would be to upgrade Socket.IO or probably just use WebSockets, though I am new to this codebase and am not 100% certain why Socket.IO 0.9 is here.

If you just want a workaround, you can manually patch the local Socket.IO installation. Go to the node_modules/socket.io for devtools-terminal, i.e. /usr/lib/node_modules/devtools-terminal/node_modules/socket.io/ and replace process.EventEmitter with require('events') globally.

Example:

sudo find . -type f -name '*.js' -exec sed -i "s/process.EventEmitter/require('events')/g" 
{} +

Perhaps a middleground between those two would be a fork of Socket.IO 0.9.x (does such possibly already exist?) or trying to convince the maintainers of Socket.IO to release a new 0.9.x build with this fixed.

(Also, still having trouble in Linux - the blank terminal bug. Oh well... It can be worked around using the solution linked to at the top of the README.)

(P.S.: Use the --chromium option if you are installing for Chromium browser.)

for mac users, if they have sed error for the command suggested above:
sudo find . -type f -name '*.js' -exec sed -i '' -e "s/process.EventEmitter/require('events')/g" {} +
https://stackoverflow.com/questions/19456518/invalid-command-code-despite-escaping-periods-using-sed

In case if you face any error "sed: RE error: illegal byte sequence"
export and then run above same command.

export LC_CTYPE=C
export LANG=C

It worked for me.