I have previously developed a module in node.js and after complete testing I put it in Github. Now I downloaded the zipped version of the same module from Github and I tried to run the module, installing all the dependencies, but now I am getting the following error:
Error:Missing PFX + certificate + private key
The complete Error Log is as follows:
Error: Missing PFX or certificate + private key.
at HTTPSServer.Server (tls.js:1029:11)
at HTTPSServer.Server (https.js:35:14)
at HTTPSServer (C:/Social/node_modules/express/node_modules/connect/lib/https.js:34:16)
at new HTTPSServer (C:/Social/node_modules/express/lib/https.js:38:23)
at Object.exports.createServer (C:/Social/node_modules/express/lib/express.js:43:12)
at Object.<anonymous> (C:/Social/app.js:46:36)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I tried to find the solution but I could not find any. Can anyone help me to with the same?
For some reason, Express thinks you want to start an HTTPS server. My guess would be this is because of this line in your code:
var app = module.exports = express.createServer(form({ keepExtensions: true }));
(link)
However, Express uses this code to see if it should start an HTTPS server:
exports.createServer = function(options){
if ('object' == typeof options) {
return new HTTPSServer(options, Array.prototype.slice.call(arguments, 1));
} else {
return new HTTPServer(Array.prototype.slice.call(arguments));
}
};
Which is a bit strange, since form()
returns a function and not an object. But to be sure, try rewriting your code to this:
var app = module.exports = express.createServer();
app.use(form({ keepExtensions: true }));