简体   繁体   中英

How to install forever-monitor module using npm in ubuntu

在我的应用程序中,我想以编程方式重新启动我的节点js服务器。为此,我需要在使用npm安装该模块时安装永久监控器,同时收到错误消息“找不到兼容版本:永久监控器”。我的节点版本为v 0.6。 17.任何人都可以帮助解决此问题。

Can you upgrade to at least node 0.8? Node.js is now on 0.10.2 so 0.6 is pretty old and many modules are no longer supporting 0.6.

Forever and forever-monitor both work very well in 0.8. The nodejitsu team is working on making forever compatible with 0.10 so that should happen soon.

Also have you looked at https://github.com/substack/fleet ? Fleet is an excellent way to manage deployments and running processes.

You need to upgrade to 0.8 atleast. forever-monitor requires node 0.8.x. See here .

You can check the node version required for a particular package by looking for engine field

npm view forever-monitor

{ name: 'forever-monitor',
  description: 'Core forever process monitor',
  'dist-tags': { latest: '1.1.0' },
...
engines: { node: '0.8.x' },

To restart your server you don't need forever. Just create, close and create the server. A small example:

var http = require('http');

var server = startServer();
// ...
server = restartServer(server);
// ...
server = restartServer(server);

function startServer() {
  return http.createServer(server).listen(server.get('port'), function(){
    console.log("Server listening on port " + server.get('port'));
  });
}

function restartServer(server) {
  server.close();
  return startServer();
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM