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:
今晚我决定尝试在Windows 7机器上使用Express构建一个简单的Node.js应用程序。安装进行得相当顺利,但Express拒绝合作。以下是我采取的步骤:
- Installed Node.js using the MSI available at http://nodejs.org/dist/v0.6.9/node-v0.6.9.msi
- Installed Express by running
npm install express g
from a command prompt. - Created a directory for the application
c:\source\node> mkdir newapp
. - Changed directory to the application directory
c:\source\node> cd newapp
. - Ran Express:
c:\source\node\newapp> express --sessions --css stylus
.
使用http://nodejs.org/dist/v0.6.9/node-v0.6.9.msi上提供的MSI安装Node.js.
通过从命令提示符运行npm install express g来安装Express。
为应用程序c:\ source \ node> mkdir newapp创建了一个目录。
将目录更改为应用程序目录c:\ source \ node> cd newapp。
Ran Express:c:\ source \ node \ newapp> 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.
此时,node.exe进程将以25%的CPU时间启动并无休止地运行,并不断使用更多内存。运行20多分钟后,node.exe进程使用300+ MB的内存。 express命令永远不会完成,newapp目录保持不变。
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.
如果我运行express --help,我会在控制台中看到帮助输出。我已经尝试运行命令提示符和管理员,但仍然显示挂起。
Does anyone have a clue what's going on or what I'm doing wrong? Thanks in advance!
有没有人知道发生了什么或我做错了什么?提前致谢!
1 个解决方案
#1
5
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.
这是Windows版本的Node v0.6.9中的错误。文件系统访问几乎搞砸了。回滚到v0.6.8 http://nodejs.org/dist/v0.6.8/node-v0.6.8.msi你应该没问题。
The Express.js command line on Windows doesn't quite work well either. I just tried with Node v0.6.8.
Windows上的Express.js命令行也不能很好地工作。我刚试过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.js并在app.configure函数中添加:
app.use(require('stylus').middleware({src: __dirname + '/public'}));
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
.
哦,你不要忘记你的NPM命令。在您的app目录中,您可能需要npm install jade和npm install stylus。
#1
5
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.
这是Windows版本的Node v0.6.9中的错误。文件系统访问几乎搞砸了。回滚到v0.6.8 http://nodejs.org/dist/v0.6.8/node-v0.6.8.msi你应该没问题。
The Express.js command line on Windows doesn't quite work well either. I just tried with Node v0.6.8.
Windows上的Express.js命令行也不能很好地工作。我刚试过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.js并在app.configure函数中添加:
app.use(require('stylus').middleware({src: __dirname + '/public'}));
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
.
哦,你不要忘记你的NPM命令。在您的app目录中,您可能需要npm install jade和npm install stylus。