下面这个错误是什么意思?
www-0 (err): at Function._load (/usr/lib/node_modules/pm2/node_modules/pmx/lib/transaction.js:62:21)
www-0 (err): at Module.require (module.js:468:17)
www-0 (err): at require (internal/module.js:20:19)
www-0 (err): at Object.<anonymous> (/usr/local/chroot/my-express-app/bin/www:63:10)
www-0 (err): at Module._compile (module.js:541:32)
www-0 (err): at Object.Module._extensions..js (module.js:550:10)
www-0 (err): at Module.load (module.js:458:32)
www-0 (err): at tryModuleLoad (module.js:417:12)
www-0 (err): at Function.Module._load (module.js:409:3)
www-0 (err): at Function._load (/usr/lib/node_modules/pm2/node_modules/pmx/lib/transaction.js:62:21)
www-0 (err): at Object.<anonymous> (/usr/lib/node_modules/pm2/lib/ProcessContainerFork.js:46:21)
www-0 (err): at Module._compile (module.js:541:32)
www-0 (err): at Object.Module._extensions..js (module.js:550:10)
www-0 (err): at Module.load (module.js:458:32)
www-0 (err): at tryModuleLoad (module.js:417:12)
www-0 (err): at Function.Module._load (module.js:409:3)
www-0 (err): at Module.runMain (module.js:575:10)
www-0 (err): at run (node.js:348:7)
www-0 (err): at startup (node.js:140:9)
www-0 (err): at node.js:463:3
我正在尝试将certbot生成的证书添加到我的快递应用程序中。下面是我的bin / www:
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('mongoose-iot:server');
var http = require('http');
// Add HTTPS support.
// https://www.hacksparrow.com/express-js-https.html
// http://stackoverflow.com/questions/11744975/enabling-https-on-express-js
// http://blog.mgechev.com/2014/02/19/create-https-tls-ssl-application-with-express-nodejs/
var https = require('https');
var fs = require('fs');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* Listen on provided port, on all network interfaces.
*/
server.listen(port);
server.on('error', onError);
server.on('listening', onListening);
/**
* Get port from environment and store in Express.
*/
var httpsPort = normalizePort(process.env.PORT || '3030');
app.set('port', httpsPort);
/**
* Create HTTPS server.
*/
// Generate self-signed certificate.
// $ openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem
// http://blog.mgechev.com/2014/02/19/create-https-tls-ssl-application-with-express-nodejs/
// http://stackoverflow.com/questions/30957793/nodejs-apn-bad-password-read
// https://startupnextdoor.com/how-to-obtain-and-renew-ssl-certs-with-lets-encrypt-on-node-js/
// https://groups.google.com/forum/#!topic/node-red/g8cPmNgGnh0
var sslPath = '/etc/letsencrypt/live/example.co.uk/';
var options = {
key: fs.readFileSync(sslPath + 'privkey.pem'),
cert: fs.readFileSync(sslPath + 'fullchain.pem')
};
var httpsServer = https.createServer(options, app);
var io = require('socket.io')(httpsServer);
/**
* Listen on provided port, on all network interfaces.
*/
httpsServer.listen(httpsPort);
httpsServer.on('error', onError);
httpsServer.on('listening', onListening);
/**
* Normalize a port into a number, string, or false.
*/
function normalizePort(val) {
var port = parseInt(val, 10);
if (isNaN(port)) {
// named pipe
return val;
}
if (port >= 0) {
// port number
return port;
}
return false;
}
/**
* Event listener for HTTP server "error" event.
*/
function onError(error) {
if (error.syscall !== 'listen') {
throw error;
}
var bind = typeof port === 'string'
? 'Pipe ' + port
: 'Port ' + port;
// handle specific listen errors with friendly messages
switch (error.code) {
case 'EACCES':
console.error(bind + ' requires elevated privileges');
process.exit(1);
break;
case 'EADDRINUSE':
console.error(bind + ' is already in use');
process.exit(1);
break;
default:
throw error;
}
}
/**
* Event listener for HTTP server "listening" event.
*/
function onListening() {
var addr = server.address();
var bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
debug('Listening on ' + bind);
}
有什么想法吗?