c4milo / node-webkit-agent

NodeJS agent for WebKit devtools front-end
http://c4milo.github.io/node-webkit-agent/
1.09k stars 78 forks source link

"Error: spawn ENOENT" from `require('webkit-devtools-agent').start();` #72

Closed terotil closed 10 years ago

terotil commented 10 years ago

Wanted to try this out on Debian Jessie, nodejs, npm and nodejs-dev packages installed

tero@fasaani:~/sc5/test$ npm install webkit-devtools-agent connect serve-static

> ws@0.4.31 install /home/tero/sc5/test/node_modules/webkit-devtools-agent/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

> webkit-devtools-agent@0.3.1 install /home/tero/sc5/test/node_modules/webkit-devtools-agent
> node-gyp rebuild

make: Entering directory '/home/tero/sc5/test/node_modules/webkit-devtools-agent/build'
  CXX(target) Release/obj.target/profiler/src/cpu_profiler.o
  CXX(target) Release/obj.target/profiler/src/heap_profiler.o
  CXX(target) Release/obj.target/profiler/src/profile.o
  CXX(target) Release/obj.target/profiler/src/profile_node.o
  CXX(target) Release/obj.target/profiler/src/profiler.o
  CXX(target) Release/obj.target/profiler/src/snapshot.o
  SOLINK_MODULE(target) Release/obj.target/profiler.node
  SOLINK_MODULE(target) Release/obj.target/profiler.node: Finished
  COPY Release/profiler.node
make: Leaving directory '/home/tero/sc5/test/node_modules/webkit-devtools-agent/build'
connect@3.2.0 node_modules/connect
├── utils-merge@1.0.0
├── parseurl@1.3.0
├── finalhandler@0.2.0 (escape-html@1.0.1)
└── debug@2.0.0 (ms@0.6.2)

serve-static@1.6.3 node_modules/serve-static
├── utils-merge@1.0.0
├── escape-html@1.0.1
├── parseurl@1.3.0
└── send@0.9.3 (destroy@1.0.3, ms@0.6.2, fresh@0.2.4, range-parser@1.0.2, debug@2.0.0, depd@0.4.5, mime@1.2.11, etag@1.4.0, on-finished@2.1.0)

webkit-devtools-agent@0.3.1 node_modules/webkit-devtools-agent
├── underscore@1.3.3
└── ws@0.4.31 (tinycolor@0.0.1, options@0.0.5, commander@0.6.1, nan@0.3.2)
tero@fasaani:~/sc5/test$ sudo apt-get install nodejs
nodejs         nodejs-dbg     nodejs-dev     nodejs-legacy  
tero@fasaani:~/sc5/test$ nodejs server.js

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: spawn ENOENT
    at errnoException (child_process.js:1000:11)
    at Process.ChildProcess._handle.onexit (child_process.js:791:34)

The server.js is

var agent = require('webkit-devtools-agent');
agent.start();

var connect = require('connect');
var serveStatic = require('serve-static');
connect().use(serveStatic(__dirname)).listen(8082);

Line 2 is the offending one.

terotil commented 10 years ago

Looks like the cause is https://github.com/c4milo/node-webkit-agent/blob/master/index.js#L32

        this.proxy = spawn('node', [__dirname + '/webkit-devtools-agent.js',
                            this.port, this.bind_to, this.ipc_port,
                            this.verbose], process.argv, {
            env: process.env,
            cwd: __dirname
        });

which assumes node executable name is "node", which does not hold for Debian, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=597571

Simple sudo ln -s /usr/bin/nodejs /usr/local/bin/node works around this.

c4milo commented 10 years ago

hm, oh debian debian debian. Let me see what I can do. Thanks for reporting this issue!

c4milo commented 10 years ago

@terotil did you try installing the nodejs-legacy package instead? see discussion: https://github.com/joyent/node/issues/4772

c4milo commented 10 years ago

@terotil I think this is a "won't fix". It is debian's issue. Unless you think otherwise.

terotil commented 10 years ago

Didn't know about nodejs-legacy. Surprising that the respective bug doesn't mention package. For me this ticket is "won't fix, install nodejs-legacy".

c4milo commented 10 years ago

@terotil thanks!