petethepig / devtools-terminal

Terminal in Chrome Devtools
http://blog.dfilimonov.com/2013/09/12/devtools-terminal.html
MIT License
1.31k stars 88 forks source link

sudo devtools-terminal --install gives error #81

Open bsr203 opened 7 years ago

bsr203 commented 7 years ago
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 7 years ago

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

ubermensh commented 7 years ago

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

sandhani commented 6 years ago

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.