永远监视器抛出ENOENT,不工作

所以我有: var forever = require('forever-monitor'); var Monitor = forever.Monitor; var child = new Monitor('clusters.js', { max: 10, silent: false, killTree: true, logFile: './logs/forever.log', outFile: './logs/app.log', errFile: './logs/error.log' }); child.on('exit', function (err) { console.log('Server exitted'); }); child.start(); 它总是抛出相同的错误:events.js:72 throw er; //未处理的“错误”事件: Error: spawn ENOENT at errnoException (child_process.js:980:11) at Process.ChildProcess._handle.onexit (child_process.js:771:34) npm ERR! weird error 8 npm […]

获得一个函数javascript的拥有对象

这更是一个普遍的问题。 我曾经看到过一些相关的答案,但没有一个给我明确的答案。 我想实现一个自动绑定function。 例: var someObject; var handle = function(arg1, callback){ someObject(arg1, callback.bind(???owner of callback???)) } var handler = new Handler(); //Calling it handle("my arg", handler.handlerFunction); 我不能够控制调用callback的someObject方法,因为它是一个第三方库,它调用我自己的callback,所以我不能在我的原型定义中使用这个。 我可以通过使用处理程序中发送的句柄函数的一个额外的参数并绑定到它来轻松实现此目的。 或者把handler.handleFunction包装到一个应用程序块中,但是我认为如果我可以按照我在代码块中提到的方式调用它,那看起来好多了。 是否有可能find对象拥有handlerFunction的引用? 我使用Nodejs,如果有任何相关性。

节点js在php网站上聊天

是否有可能创build一个聊天function的php网站,聊天function写在节点js? 它只是我读过的所有教程,索引页由节点js服务。 我不希望节点做到这一点。 我想要xpppp来做到这一点。 我只需要从浏览器交换聊天到服务器。 可能吗。 如果是的话,怎么样? 请帮帮我。 我被困了一个星期了。 我已经问过类似的问题,我没有得到有用的答案。 提前致谢。

是否有可能使用适应性付款从我自己的PayPal帐户发送电子邮件到一个电子邮件地址

我有一个node.js的Web应用程序,有时需要发送一个用户只知道他们的电子邮件地址的钱。 这与PayPal的汇款界面基本上是一样的,但需要以编程方式执行。 我已经看过这个post ,build议使用他们较新的Adaptive Payments API来做到这一点,然而在文档或例子中,我没有看到如何从我的账户发送钱到一个电子邮件地址。 我唯一的select是进入Pay​​Pal正在离开的MassPay API吗?

在Cloud9 IDE中获取用户的真实IP地址

在node.js + socket.io中,我使用这个代码来获取用户的IP地址: var clientIP = socket.handshake.headers['x-forwarded-for'] || socket.handshake.address.address; 但结果是错误的。 我console.log这些值,并得到以下结果: socket.handshake.address.address显然是内部IP(127.xxx) x-forwarded-for是cloud9的代理之一(107.23.232.64,54.236.78.114,107.23.123.140)。 所以显然是使用双重代理,其中一个代理层不提供'x-forwarded-for'头部,对吗? 使用cloud9绝对不可能获得真正的用户IP吗? 这对我的项目是至关重要的。

节点js与C的比较

在我的双核机器上,Node JS的运行速度比用C编写的同等程序快 节点是如此的优化以至于效率更高,或者我的C程序有什么问题让它变慢? 节点js代码: var Parallel = require("paralleljs"); function slow(n){ var i = 0; while(++i < n * n){} return i; } var p = new Parallel([20001, 32311, 42222]); p.map(slow).then(function(data){ console.log("Done!"+data.toString()); }); C代码: #include <stdio.h> #include <pthread.h> struct thread_s { long int n; long int r; }; void *slow(void *p){ thread_s *t = (thread_s*)p; long […]

从MySQL开始,将来更改为MongoDB?

我是新来的node.js我打算使用MySQL以外的数据库(可以说MongoDB),但我只熟悉MySQL。 你认为先使用MySQL,并在未来更改为MongoDB? 或快速学习MongoDB并从头开始使用MongoDB?

Travis CI作业失败,结果未知“已configuration”

这是我的.travis.yml language: node_js node_js: – 0.8 before_script: – export DISPLAY=:99.0 – sh -e /etc/init.d/xvfb start 简单地得到: Using worker: worker-linux-2-1.bb.travis-ci.org:travis-linux-19 An error occured while compiling the build script : unknown result "configured"

如何使用访问令牌在通过twitter.js护照login后validation用户

我需要在我的node.js应用程序上构build一个基于令牌的身份validation,用户可以使用他的Facebook或Twitter凭据login我的应用程序,并使用访问令牌获取资源。 这个postbuild议一旦通过Facebook或Twitter或其他authentication,每个请求使用访问令牌,并不需要会话 例如 GET / api / v1 / somefunction?token ='abcedf' 客户端从响应中获取访问令牌。 客户端使用token参数调用一些服务器API。 所以下面的代码是通过twitter授权用户,如果我的应用没有find我的用户信息,那么把用户信息存储到数据库中。 passport.use(new TwitterStrategy({ consumerKey: config.twitter.clientID, consumerSecret: config.twitter.clientSecret, callbackURL: config.twitter.callbackURL }, function(token, tokenSecret, profile, done) { console.log('TwitterStrategy /auth/twitter………….',profile.id, profile.displayName, profile.username, profile.emails[0], profile._json.avatar_url); userModel.findUserByQuery({ 'social.twitter.id': profile.id }, function (err, user) { if (!user) { console.log('twitter user not found'.red); userModel.createNewUser( { username:profile.username, email:profile.emails[0].value, img:profile._json.avatar_url, fullname:profile.displayName, […]

Log.io,自动永久设置最新日志

我使用永远自动重新启动我的应用程序在发生问题的情况下。 最近我发现了一个非常好的应用程序来监视我的服务器中的不同的日志从一个浏览器,这是log.io。 Log.io允许我设置要监视的日志文件,例如: logStreams: { apache: [ "/var/log/apache2/access.log", "/var/log/apache2/error.log" ] }, 对于apache来说,它的function就像一个魅力,因为文件名总是相同的。 但永远在我的应用程序的每次重新启动创build一个全新的文件名( [a-zA-Z0-9-_]{4}.log )。 有没有办法永久设置一个静态的日志文件名,或者dynamic地在log.io的configuration中设置最新的日志文件? 你会build议哪种方法?