1

So the problem is that node.js doesn't send my javascript files correctly. I can find them in the html code, but they are not executed by the browser. Those js files don't even appear in the firebug's NET panel when I reload the page.

I am using Express with Jade.

Any ideas how to fix this issue? Or what's causing it?

1
  • More information? Are you including the files in your templates? Can we see your templates. You need to have a script(type='text/javascript' src='url') in your template. Commented Apr 14, 2011 at 19:05

1 Answer 1

3

Make sure you have express.static set properly in app.configure.

app.configure(function(){
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
  app.use(express.static(__dirname + '/public'));
});

// Also, make sure you have the most updated versions of express and node.js. Both change often.

Sign up to request clarification or add additional context in comments.

1 Comment

This shows me where I have to store my custom .js files: "/public". Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.