I need blender command-line access though spawn but keep running into an ENOENT error and it is hard to pinpoint what is missing. The command-line being passed in the sample application works in terminal.

Below are some details about the environment and the sample script I am using.

Environment (OSX El Capitan)

  1. Installed Blender 2.76b with:

    brew install Caskroom/cask/blender

  2. Then add alias to bash_profile for terminal access:

    alias blender="/Applications/blender/Blender.app/Contents/MacOS/blender"

Test Code

#!/usr/bin/env node
var child_process = require('child_process');
var arguments = [
        '-o', 'test-#',
        '-f', 0
console.log("values: ", arguments);
var child = child_process.spawn('blender', arguments);

child.stdout.on('data', function(data) {
    console.log('data out: ', data.toString());
child.stderr.on('data', function(data) {
    console.error('error out: ',data);
child.on('close', function(code) {
    console.log('closing code: ' + code);

// Raw command-line for terminal. (PASS)
// blender -b recipe.blend -o test-# -f 0

1 Answer 1


Try changing the child_process.spawn('blender', arguments); line to child_process.spawn('/Applications/blender/Blender.app/Contents/MacOS/blender', arguments);. NodeJS won't be using your bash aliases, so unless the blender executable is in its PATH it won't be able to find the executable and will throw an ENOENT.

The other option is adjusting Node's PATH to include the path to the blender executable. You could also pass the fullpath to the blender executable in as an environment variable.



You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .