为什么我的节点静态文件服务器丢失请求?

我有一个标准的node.js静态文件服务器,我想用它来为同一个目录(即典型的HTML5单页面应用程序)提供正常的html,js,css和jpg文件。 我希望节点服务器可以正确处理这个问题。 我看到的是不同的。

index.html文件被提供,但随后的请求被删除(即,他们从来没有把它送到服务器)。 在我的chrome开发工具中,我看到像这样的东西:

 GET http://projectcoho.cloudfoundry.com/css/coho.css http://projectcoho.cloudfoundry.com/:7 GET http://projectcoho.cloudfoundry.com/sencha-touch/sencha-touch-debug.js http://projectcoho.cloudfoundry.com/:8 GET http://projectcoho.cloudfoundry.com/coho-debug.js http://projectcoho.cloudfoundry.com/:8 

但是,这些资源存在于服务器上,如果您直接inputURL,则可以访问这些资源。 而对于这些请求,我的callback在app.js从来没有被调用(我可以告诉这个,因为console.log从来没有被要求这些文件。

这是app.js文件:

 var path = "."; var port = process.env.VCAP_APP_PORT || 3000;; var file = new(static.Server) (path, { cache: 600 }); mime.define({ 'text/css': ['css'], 'text/javascript': ['js'], 'image/jpeg': ['jpg', 'jpeg'] }); http.createServer(function (request, response) { var uri = url.parse(request.url).pathname; var filename = libpath.join(path, uri); console.log("URI: " + request.url + " , filename: " + filename); libpath.exists(filename, function (exists) { console.log("Serving " + filename); if (!exists) { console.log("Not found"); response.writeHead(404, { "Content-Type": "text/plain" }); response.write("404 Not Found\n"); response.end(); return; } if (fs.statSync(filename).isDirectory()) { filename += '/index.html'; } var type = mime.lookup(filename); file.serveFile(filename, 200, {'content-type' : type}, request, response); }); }).listen(port); 

我在这里错过了什么?

我正在使用节点v0.6.15

最后,答案是我的cache.manifest文件是不正确的。 客户端应用程序正在查找caching中的资源,但不存在。 当我纠正清单,事情开始工作。