Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tamitutor opened this issue Mar 12, 2013 · 4 comments

Comments

@tamitutor
Copy link

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

@jonpacker
Copy link
Contributor

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.

@lbeschastny
Copy link

According to express-expose Readme.md, latest express-expose@0.3.4 is only compatible with express@4.x:

  • express@4.x (use express-expose at >= 0.3.4)
  • express@3.x (use express-expose at >= 0.2.3 and <= 0.3.3)
  • express@2.x (use express-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.

@niftylettuce
Copy link
Contributor

@lbeschastny pull request welcome

@lbeschastny
Copy link

@niftylettuce I don't think that anything could be done about express@2.x/express@3.x.

As for express@3.x/express@4.x, you could re-release latest express-expose under 0.4.0 version, marking current express-expose@0.3.4 release as deprecated (or even unpublishing it). It'll resolve all versioning problems for express@3.x 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 express-expose@0.3.4 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants