Domanda

I have previously developed a module in node.js and after complete testing put it in git hub. Now i downloaded the zipped version of same module from githup and tried to run the module, installed 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 could not find any. Can anyone help me to with the same. Thanks in advance.

È stato utile?

Soluzione

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 }));
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top