Node.js and Express on Windows

Tonight I decided I’d try to build a simple Node.js
application using Express on my Windows 7 machine. The installation went fairly smoothly, but Express refuses to cooperate. Here are the steps I’ve taken:

  1. Installed Node.js
    using the MSI available at
  2. Installed Express by running npm install express g
    from a command prompt.
  3. Created a directory for the application c:sourcenode> mkdir newapp
  4. Changed directory to the application directory c:sourcenode> cd newapp
  5. Ran Express: c:sourcenodenewapp> express --sessions --css stylus

At this point the node.exe process fires up and runs endlessly at 25% CPU Time and continually uses more memory. After running for 20+ minutes the node.exe process uses 300+ MB of Memory. The express
command never completes and the newapp
directory remains unaltered.

If I run express --help
I see the help output in the console. I’ve tried running the command prompt as and Administrator but still Express appears to hang.

Does anyone have a clue what’s going on or what I’m doing wrong? Thanks in advance!

Problem courtesy of: Phil Klein


This is a bug in the Windows version of Node v0.6.9. Filesystem access is pretty much messed up. Rollback to v0.6.8
and you should be fine.

The Express.js command line on Windows doesn’t quite work well either. I just tried with Node v0.6.8.

This works

express --sessions myapp

This doesn’t work for me

express --sessions --css stylus myapp

Fortunately you can add stylus support manually in your generated app. Open up app.js
and in the app.configure
function, add:

app.use(require('stylus').middleware({src: __dirname + '/public'}));

Hope this helps!


Oh ya, don’t forget your NPM commands. In your app directory, you may need to npm install jade
and npm install stylus

Solution courtesy of: JP Richardson

Node.js Recipes责编内容来自:Node.js Recipes (源链) | 更多关于

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 前端开发 » Node.js and Express on Windows

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录