Comments (1)
Yes it doesn't work because in the server.js CompoundJS use module.parent, and as pm2 wrap the code in child process the code is not executed.
To fix it :
#!/usr/bin/env node
/**
* Server module exports method returning new instance of app.
*
* @param {Object} params - compound/express webserver initialization params.
* @returns CompoundJS powered express webserver
*/
var app = module.exports = function getServerInstance(params) {
params = params || {};
// specify current dir as default root of server
params.root = params.root || __dirname;
return require('compound').createServer(params);
};
//if (!module.parent) {
var port = process.env.PORT || 3000;
var host = process.env.HOST || '0.0.0.0';
var server = app();
server.listen(port, host, function () {
console.log(
'Compound server listening on %s:%d within %s environment',
host, port, server.set('env')
);
});
//}
from pm2.
Related Issues (20)
- Graviton3 support – intermittent crash/coredump HOT 1
- Configuration file management app log confusion issues.
- PM2 start with next.js is too slow
- Replace/remove/fix vizion dependency causing annoying popups flashing in Windows
- Pm2 God Daemon crashes and does not properly recover
- Logs more than 2 years before are included into current daily logs with huge sizes HOT 1
- pm2 out_file : dev/null not working HOT 1
- How to use Pm2 for deferent Port in NextJS app
- == HELP == status errored
- pm2 do not start first
- Can not run pm2 runtime with nextjs?
- variable God
- Error `cause` is not displayed when PM2 is started in cluster mode
- When I run pm2 start server.js a virus is detected by BitDefender HOT 1
- Deploy to EC2 in private subnet
- pm2 logs don't update live unless I do "pm2 update" or "pm2 restart" HOT 1
- Exception is not written to ~/.pm2/logs/*.log file from uncaughtException since it's synchronous
- HTTPS Mean Latency missing for two processes
- boot time startup on Ubuntu 24.04 with Wayland, fails HOT 1
- util.isArray is deprecated HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pm2.