execSync与meteor

时间:2013-01-10 22:46:54

标签: node.js meteor

我正在尝试使用execSync包来获取同步shell功能。虽然我最初由于缺少binding.node文件而遇到问题,但我通过在适当的node-gyp目录中运行execSync来解决它。现在,我可以在节点内调用execSync函数而不会出现任何问题。

然而,当我尝试使用meteor中的函数时,我收到以下错误:

Running on: http://localhost:3000/
/usr/lib/meteor/bin/node: symbol lookup error: /home/onur/node_modules/execSync/node_modules/ffi/node_modules/ref/build/Release/binding.node: undefined symbol: _ZNK2v85Value6IsNullEv
Exited with code: 127
Your application is crashing. Waiting for file change.

注意:

通过网络快速检查显示该符号属于V8库。

守则

我在Meteor.methods中定义了以下内容。

getpuzzle: function (clu, lo, hi) {
    var require = _meteor_bootstrap__.require;   
    var exec = require('execSync');
    var sudoku_str = exec.stdout(path_sudoku_gen+" "+clu+" "+lo+" "+hi);  
    console.log(sudoku_str); 
    return sudoku_str;                                        
}    

我试图找出服务器和客户端之间的交互。基本上,我正在尝试this。客户端上的函数需要一个由服务器端执行的python脚本返回的字符串。我尝试使用全局变量进行脏攻击,但它仍无关紧要,因为脚本是异步运行的。我可以不同步执行吗?我无法完全掌握客户端 - 服务器交互的模型,因此如果有正确的方法,请随时纠正我。

1 个答案:

答案 0 :(得分:0)

由于您没有显示代码,我假设您的需求行失败。而不是标准的node.js要求你必须使用Meteor包装器

var require = __meteor_bootstrap__.require;
var path = require('path')