express icon indicating copy to clipboard operation
express copied to clipboard

Cannot find Index.html? ( DO NOT USE node 0.3.x yet :) )

Open pyrostrex opened this issue 16 years ago • 9 comments

Ok, i've tried to use the html5-boilerplate which was found in the express's wiki. I update all the submodule to the latest. Then, i tried to run the code. It looks fine until, it shows error on finding index.html even though the router already been told to render index.ejs instead of index.html. What happened here??. I already tried changing the render to send('hello world') and what i get is still the same. "Cannot find index.html". Then, when i disable the staticProvider option, it success route but i can't access all the css and stuff. Please help. thank you.

pyrostrex avatar Sep 17 '10 09:09 pyrostrex

I havent personally used the boilerplate app

tj avatar Sep 17 '10 14:09 tj

Well this is not happening to me before.. Right after this day. I try to do fresh install once again from start (include node build). Then i got this error. Ughh.. It's getting more frustrating when npm 2.0 error on installation. Ughh..

pyrostrex avatar Sep 17 '10 16:09 pyrostrex

Yeah, after some investigation. It WAS really node.js official problem or maybe because of express incompatibility or maybe because of connect? I don't know because i don't wanna start blaming something. I don't know why. But yeah. This problem only raise when i apply the staticProvider setting in express. When i remove that setting, it's ok. It can render properly.. But since i store all the static data in a "static" folder. So, everything such as the css and js file couldn't be detected.

pyrostrex avatar Sep 17 '10 16:09 pyrostrex

i dont even know what the boilerplate thing is trying to do, serve index.html? instead of a view? best to take it up with that repo

tj avatar Sep 17 '10 17:09 tj

No... I've done some more investigation. This time, i've tried to change my current node to the latest one in the distribution list at http://www.nodejs.org . It's now working again!! Yippe.!! This only occured when i try to use the nodejs that was rebuilt from the latest nodejs from the git repository.

pyrostrex avatar Sep 18 '10 00:09 pyrostrex

ooohh weird :) k well safe to close then

tj avatar Sep 18 '10 01:09 tj

Anyway, I'm still hoping that you'll check this problem. Thank you. Here is the simplest code i can give to demonstrate the error. (You need the latest nodejs from the master repository for this).

var express     = require('express'),
      server        = express.createServer();

server.use(express.bodyDecoder());
server.use(express.staticProvider(__dirname + "/public"));

server.get('/', function(REQUEST, RESPONSE){
    RESPONSE.render('index.ejs');
});

server.listen(80);

and.. this is what i get.

Error: ENOENT, No such file or directory '/usr/pyrostrex/thredon004/public/index.html'

pyrostrex avatar Sep 18 '10 14:09 pyrostrex

hmm definitely staticProvider trying to grab index.html... not sure why in that case though. Try ahove use(express.static...) add server.use(express.router) giving the routes precedence over staticProvider

tj avatar Sep 18 '10 16:09 tj

Also encountered this bug with node's head from ry checked out today. Rolling back to the distro 0.2.2 eliminated this problem.

cefn avatar Sep 30 '10 15:09 cefn