1

I ran into this error using node.js v0.10.12 in MacOS and linux, this piece of code work fine in windows 7. The only differences is on windows 7 I have admin id, on MacOSX and linux , I am not root and just plan user.

Do we need to be root to work with child_process? Any clue about why it fails on some OS and not all? Thanks so much,

This is the code:

var spawn = require('child_process').spawn; try { var child = spawn('node', ['plusone.js']); //call every minute setInterval(function() { // var number = Math.floor(Math.random() * 10000); child.stdin.write(number +'\n'); child.stdout.once('data', function(data) { console.log('child replied to '+ number +' with ' +data); }); },1500); child.stderr.on('data', function(data) { process.stdout.write(data); }); } catch (e) { console.log("entering catch block"); console.log(e); } 
1
  • 1
    ENOENT means it cannot find the command/file you are trying to execute. Is node found in the PATH for that user. Commented Aug 8, 2013 at 4:51

1 Answer 1

2

Hi All: I think I got my answer. The reason why it did not work on the other OS is my configuration.

If did not configure the node on the system path so that it can be accessible everywhere unless the path is specified.

Sign up to request clarification or add additional context in comments.

1 Comment

I tried to search online for exactly the same problem but only to get a lot of answers about ImageMagick, while I already had it installed years ago. Finally made it work according to this one. The reason turns out to be Debian's nodejs's executable is named nodejs instead of node. A simple ln would solve the problem. Thank you!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.