express-expose
express-expose copied to clipboard
On application start-up: "TypeError: Cannot set property 'expose' of undefined"
My code for requiring expose looks like this:
------------------BEGIN CODE--------------------- var express = require('express') , expose = require('express-expose') , program = require('commander') , cookie = require('cookie') , routes = require('./routes') , api = require('./routes/api.js') , passport = require('passport') , BasicStrategy = require('passport-http').BasicStrategy , config = require('config') ;
program .version('0.0.1') .option('-t, --test', 'Run as a test') .parse(process.argv);
var app = module.exports = express.createServer(); ------------------END CODE---------------------
The specific line in express-expose.js throwing the error is line 44.
Please see the attached image...
It looks like you might be using an old version of express that doesn't expose the express app prototype that way that express-expose expects. If you upgrade to express 3 this should fix itself.
According to express-expose
Readme.md, latest [email protected]
is only compatible with [email protected]
:
-
[email protected]
(useexpress-expose
at>= 0.3.4
) -
[email protected]
(useexpress-expose
at>= 0.2.3
and<= 0.3.3
) -
[email protected]
(useexpress-expose
at<= 0.2.2
)
Using the same patch version for different major releases of express
seems like a violation of Semantic Versioning to me.
@lbeschastny pull request welcome
@niftylettuce I don't think that anything could be done about [email protected]
/[email protected]
.
As for [email protected]
/[email protected]
, you could re-release latest express-expose
under 0.4.0
version, marking current [email protected]
release as deprecated (or even unpublishing it). It'll resolve all versioning problems for [email protected]
users.
As for pull-request
, maintiners usually don't like contributors messing with package version, but if you want, I'll create one. Though, it'll be pointless without either deprecating or unpublishing current [email protected]
release.