title: Basic Express + Stylus setup question (getting ENOENT)
body: <p>UPDATE: After updating to stylus 0.7.4 and express 2.3.12 I can no longer reproduce this.  Presumably it was a bug somewhere in an earlier version of stylus.</p>
  
  <p>I'm trying to get the most basic express + stylus setup hooked up.  I want to have screen.styl rendered into css and returned in the response when a GET for /screen.css is handled.</p>
  
  <p>I've debugged into the stylus middleware and the debugger is jumping around in ways I can't follow.  The stylus middleware code looks fine, but a <code>GET /screen.css</code> is resulting in a <code>Error: ENOENT, No such file or directory '/Users/plyons/projects/test_stylus/screen.css'</code> going out in the response.</p>
  
  <p>I have a test directory with just 2 files (the server is in coffeescript, but it's trivial).</p>
  
  <pre><code>screen.styl     server.coffee
  </code></pre>
  
  <p>cat server.coffee </p>
  
  <pre><code>express = require 'express'
  app = express.createServer()
  app.use require('stylus').middleware(__dirname)
  app.use express.static __dirname
  app.listen 9800
  </code></pre>
  
  <p>cat screen.styl </p>
  
  <pre><code>a
    background-color red
  </code></pre>
  
  <p>From staring at the stylus middleware.js file for quite a while, I think this <em>should</em> work.  The stylus middleware is definitely executing and attempting to do <code>fs.stat</code> on both the <code>.styl</code> file, which exists, and the <code>.css</code> file, which does not yet exist, thus the <code>ENOENT</code>, but the middleware looks like it should detect that <code>ENOENT</code> and handle it without any problems (compile the .styl and save the result in the .css).  But no .css file is being written.  If it was written, the system is designed for the middleware to call <code>next()</code> without actually sending anything in the response, but then the static provide would find the .css file and send it as the response, right?</p>
  
  <p>Anyone know what I've got wrong here?</p>