node-packer
node-packer copied to clipboard
Multiple processes
This really looks like a cool and interesting project. One thing I can't seem to find out about is multiple processes.
We use pm2 (and looking at the node 8 cluster https://nodejs.org/api/cluster.html#cluster_how_it_works) and I was wondering how this would work using node-compiler
thanks
Whatever works before should also work after compiling. Could you be more specific about the issue? Like the steps to reproduce an unexpected situation. Thanks.
I got the following error when using pm2 in cluster mode
> 40|test | (function (exports, require, module, __filename, __dirname) { ELF
> 40|test | ^
> 40|test | SyntaxError: Invalid or unexpected token
> 40|test | at createScript (vm.js:74:10)
> 40|test | at Object.runInThisContext (vm.js:116:10)
> 40|test | at Module._compile (module.js:537:28)
> 40|test | at Object.Module._extensions..js (module.js:584:10)
> 40|test | at Module.load (module.js:507:32)
> 40|test | at tryModuleLoad (module.js:470:12)
> 40|test | at Function.Module._load (module.js:462:3)
> 40|test | at /usr/local/lib/node_modules/pm2/lib/ProcessContainer.js:328:23
> 40|test | at /usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:473:16
> 40|test | at next (/usr/local/lib/node_modules/pm2/node_modules/async/dist/async.js:5315:29)
should be able to reproduce with the following code:
var express = require('express')
var app = express()
app.get('/', function (req, res) {
res.send('Hello World')
})
app.listen(3000)
compile flag "nodec --make-args="-j2" -r . -o ~/test.out server.js"
start it by pm2 start test.out
is fine. (single process mode)
start it by pm2 start test.out -i 2
in multi process mode causes the above error
using node 8.3, pm2 2.9.1, ubuntu server 16.04 LTS
Any clues which part I did it wrong? Thanks
Same error here like @evanchan
1|app | /pkg/app:1
1|app | (function (exports, require, module, __filename, __dirname) { ELF
1|app | ^
1|app | SyntaxError: Invalid or unexpected token