缺省Node.js + Express.js不运行 [英] Default Node.js + Express.js does not run
问题描述
我正在尝试使用 nodejs
和 expressjs
创建网络应用程序,遵循入门指南 expressjs网站,标题为使用express(1)生成应用。
我使用 express-generator
插件生成了一个应用程序,运行 npm install
,然后尝试使用节点应用程序
运行应用程序(我也尝试了 node app.js
来衡量当运行这些命令之一时,终端没有任何输出。
我还尝试使用调试应用程序调试应用程序
,具有以下结果:
<调试器侦听端口5858
连接.. 。ok
在app.js中的中断:1
1 var express = require('express');
2 var http = require('http');
3 var path = require('path');
debug> cont
prog ram终止
调试> cont
应用程序没有运行...尝试`run`而不是
debug>
我找到了一个文件 bin / www
似乎包含启动服务器的代码,并且确定运行 node bin / www
成功启动应用程序。
我在这里缺少什么?
看起来开始应用程序的方式已经改变。 c code code code code >
这里有更多细节 https://github.com/expressjs/generator
I am trying to learn to create web apps with nodejs
and expressjs
, following the getting started guide found at the expressjs website, under the heading Using express(1) to generate an app.
I generated an app using the express-generator
plugin, ran npm install
, and then attempted to run the application by using node app
(I also tried node app.js
for good measure. When running either of these commands, there is no output to the terminal whatsoever.
I also tried to debug the application using node debug app
, with the following results:
< debugger listening on port 5858
connecting... ok
break in app.js:1
1 var express = require('express');
2 var http = require('http');
3 var path = require('path');
debug> cont
program terminated
debug> cont
App isn't running... Try `run` instead
debug>
I did find a file bin/www
that seemed to contain the code to start the server, and, sure enough, running node bin/www
succeeded in starting the application.
What am I missing here?
Looks like the way to start app has changed. Instead of node app
you should now do
npm start
More details here https://github.com/expressjs/generator
这篇关于缺省Node.js + Express.js不运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!