Blender命令行的Node.js产生?
我需要搅拌机命令行访问,虽然spawn
但继续运行到一个ENOENT
错误,很难找出缺less的东西。 示例应用程序中传递的命令行在terminal中运行。
以下是关于环境和我正在使用的示例脚本的一些细节。
环境(OSX El Capitan)
-
安装搅拌机2.76b与:
brew install Caskroom/cask/blender
-
然后添加
alias
到bash_profile
进行terminal访问:alias blender="/Applications/blender/Blender.app/Contents/MacOS/blender"
testing代码
#!/usr/bin/env node var child_process = require('child_process'); var arguments = [ '-b', 'recipe.blend', '-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
尝试改变child_process.spawn('blender',arguments); line to child_process.spawn('/ Applications / blender / Blender.app / Contents / MacOS / blender',arguments);. NodeJS不会使用你的bash别名,所以除非blender可执行文件在PATH中,否则它将无法find可执行文件,并且会抛出一个ENOENT。
另一个选项是调整节点的path,以包含搅拌机可执行文件的path。 您也可以将完整path作为环境variables传递给blender可执行文件。
干杯!
- sshpass命令在node.js中不起作用
- Nodejssubprocess在容器docker中产生
- 为什么nodejs产生的进程变成<defunct>直到父进程退出
- 节点child_process.spawn多个命令
- 将产卵过程的标准输出转化为超级上传
- 节点:按顺序产生进程,inheritancestdio
- 错误:使用非root用户使用Node.js child_process时,在errnoException(child_process.j2:980:11)处产生ENOENT
- Nodejs总是不能完全捕获subprocess的stdout数据,除非subprocessfllush(stdout)
- 使用没有ES6语法和良率的Nightmare.js