express-expose icon indicating copy to clipboard operation
express-expose copied to clipboard

On application start-up: "TypeError: Cannot set property 'expose' of undefined"

Open tamitutor opened this issue 11 years ago • 4 comments

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... Screen Shot 2013-03-12 at 10 41 02 AM

tamitutor avatar Mar 12 '13 14:03 tamitutor

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.

jonpacker avatar Mar 14 '13 14:03 jonpacker

According to express-expose Readme.md, latest [email protected] is only compatible with [email protected]:

Using the same patch version for different major releases of express seems like a violation of Semantic Versioning to me.

lbeschastny avatar Dec 10 '14 15:12 lbeschastny

@lbeschastny pull request welcome

niftylettuce avatar Dec 10 '14 16:12 niftylettuce

@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.

lbeschastny avatar Dec 10 '14 16:12 lbeschastny