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

Already on GitHub? Sign in to your account

After update to 3.0.1 I got this error: has no method 'static' #1045

Closed
renanreismartins opened this Issue Jun 20, 2014 · 9 comments

Comments

Projects
None yet
4 participants

Hey guys, today I installed connect and tried to use as it is in the official page:

var app = connect()
  .use(connect.static('public'))
  .use(function(req, res){
    res.end('hello world\n');
  })

http.createServer(app).listen(3000);

but when I try to up node: node webserver.js

I got this stack trace:

ubuntu@lalala:/var/www/apprender$ node webserver.js

/var/www/project/webserver.js:3
  .use(connect.static('public'))
                     ^
TypeError: Object function createServer() {
  function app(req, res, next){ app.handle(req, res, next); }
  merge(app, proto);
  merge(app, EventEmitter.prototype);
  app.route = '/';
  app.stack = [];
  return app;
} has no method 'static'
    at Object.<anonymous> (/var/www/project/webserver.js:3:22)
    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)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3
Contributor

dougwilson commented Jun 20, 2014

Hi! When you do a major version upgrade, please read the readme. The different replacement middlewares are listed here: https://github.com/senchalabs/connect#middleware

@dougwilson dougwilson closed this Jun 20, 2014

Contributor

dougwilson commented Jun 20, 2014

@dougwilson dougwilson added the v3.0 label Jun 20, 2014

DarrylD commented Jul 10, 2014

I did the same thing and used the same code on the homepage (not an upgrade from previous version). I got the error. Not sure which additional module to use but, having the sample code on the homepage break it pretty confusing.

Contributor

dougwilson commented Jul 10, 2014

Member

tj commented Jul 10, 2014

I think that's just gh-pages for the connect repo. worst static site ever hahah

Contributor

dougwilson commented Jul 10, 2014

I think that's just gh-pages for the connect repo. worst static site ever hahah

Cool. That's what I thought also, but apparently I had to click on "more stale branches", lol

https://github.com/senchalabs/connect/branches/stale

Member

tj commented Jul 10, 2014

hahahaha

Contributor

dougwilson commented Jul 11, 2014

having the sample code on the homepage break it pretty confusing.

I 100% agree. I'm going to tag the latest 2.x as "latest" on npm for now until this is resolved, so users are not confused.

@dougwilson dougwilson reopened this Jul 11, 2014

Contributor

dougwilson commented Jul 21, 2014

Someone just dropped by #express and reminded me of this issue. For the time being I have added a HTML meta refresh to the README on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment