Node.js and Express on Windows

前端 未结 1 1769
不知归路
不知归路 2021-02-02 03:16

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.

相关标签:
1条回答
  • 2021-02-02 04:01

    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 http://nodejs.org/dist/v0.6.8/node-v0.6.8.msi 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!

    Update:

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

    0 讨论(0)
提交回复
热议问题