本文介绍了缺省Node.js + Express.js不运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 c code code code code >



这里有更多细节


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不运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 18:10
查看更多