Comments (23)
just type npm start
from generator.
There are no problems until
npm start
, I get this in the prompt:
I did type npm start
. But then, when I visit http://localhost:3000
the whole thing quits with the error message I quoted above.
from generator.
@szmarci what is the output for the following command: which node
?
from generator.
it's /usr/local/bin/node
update: I don't know if it makes a difference but prior to installing node I changed ownership of the /usr/local
folder, so I don't have to sudo everytime I install something
from generator.
It shouldn't. I asked because the error you posed says that when npm
tried to run node ./bin/www
, it couldn't fine any binary called node
in $PATH
.
from generator.
well, node works just fine. do you have any idea what else can I try?
from generator.
I have no idea, I'm sorry. It may be worth asking on npm
issue tracker, or try to debug the error since I cannot reproduce it.
from generator.
I will try to reinstall everything, node, npm, express and I'll come back with the result.
from generator.
so I did reinstall everything, node, npm, express, etc... and for some strange reason it seems it is now working. after npm start
I get this:
> node ./bin/www
GET / 304 573ms
GET /stylesheets/style.css 304 2ms
GET / 304 35ms
GET /stylesheets/style.css 304 40ms
after there is a spinning backslash and localhost:3000
shows the test page correctly.
I have no idea what was wrong. maybe because node bumped from 10.28 to 10.29 ?
from generator.
and for some strange reason it seems it is now working
ok, i'm going to close this issue.
after there is a spinning backslash
the node.js 0.10.29 comes with a broken npm in this regard; if you don't want to see that spinner you'll have to upgrade your npm.
from generator.
"I will try to reinstall everything, node, npm, express and I'll come back with the result."
@szmarci
I think I've similar problems as you had.
How did you reinstalled all this stuff, especially express?
from generator.
@draschke sorry for the late reply. I followed the instructions in this answer for node and npm.
for express I don't remember exactly, but I might just used npm uninstall
or I removed the executable directly.
from generator.
:)
Thank you!
from generator.
I encountered this issue and finally get it solved by running the following command:
$ gem update --system
$ gem install compass
source: Vigrond
from generator.
@renfeisong thank you.
Indeed, I had the same issue and was due to a missing installation of Compass. Just running gem install compass
solved the issue.
Thanks!
from generator.
I'm running Node.js on windows 8, and when I'm encountering the same/similar issue. I follow these steps and it works perfectly until Iry :
C:\node\nodetest>npm start
app.use.(function(req,res,next) {
TypeError: Cannot read property 'use' of undefined
at Object.<anonymous> {C:\node\nodetest\app.js:19:4)
at Module._compile (module.js:460:26)
at Object.Module._estiensions..js (module.js:478:10
at Module.load (module.js:355:17)
at require (module.js:365:17)
at Object.<anonymous> (C:\node\nodetest\bin\www:7:11)
at Module._compile (module.js:460:26)
at Obeject.Module._extensions..js (module.js:478:10)
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\node.js\\\\node.exe" "C:\\Program Files\\node.js
\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v0.12.2
npm ERR! npm v2.7.4
npm ERR! ELIFECYCLE
npm ERR! [email protected] start 'node ./bin/www',
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node./bin/www'
npm This is most likely a problem with the nodetest package, not with npm itself
AND this is my debug log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart [email protected]
7 info start [email protected]
8 verbose unsafe-perm in lifecycle true
9 info [email protected] Failed to exec start script
10 verbose stack Error: [email protected] start: `node ./bin/www`
10 verbose stack Exit status 1
10 verbose stack at EventEmitter.<anonymous> (C:\Program
Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:213:16)
10 verbose stack at EventEmitter.emit (events.js:110:17)
10 verbose stack at ChildProcess.<anonymous> (C:\Program
Files\nodejs\node_modules\npm\lib\utils\spawn.js:14:12)
10 verbose stack at ChildProcess.emit (events.js:110:17)
10 verbose stack at maybeClose (child_process.js:1015:16)
10 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
11 verbose pkgid [email protected]
12 verbose cwd C:\node\nodetest3
13 error Windows_NT 6.3.9600
14 error argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program
Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
15 error node v0.12.2
16 error npm v2.7.4
17 error code ELIFECYCLE
18 error [email protected] start: `node ./bin/www`
18 error Exit status 1
19 error Failed at the [email protected] start script 'node ./bin/www'.
19 error This is most likely a problem with the nodetest3 package,
19 error not with npm itself.
19 error Tell the author that this fails on your system:
19 error node ./bin/www
19 error You can get their info via:
19 error npm owner ls nodetest3
19 error There is likely additional logging output above.
20 verbose exit [ 1, true ]
This is my app.js where the 'use' function is being called:
var express = require('express');
var path = require('path');
var favicon = require('serve-favicon');
var logger = require('morgan');
var cookieParser = require('cookie-parser');
var bodyParser = require('body-parser');
var routes = require('./routes/index');
var users = require('./routes/users');
/// catch 404 and forwarding to error handler
app.use(function(req, res, next) {
var err = new Error('Not Found');
err.status = 404;
next(err);
});
/// error handlers
// development error handler
// will print stacktrace
if (app.get('env') === 'development') {
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: err
});
});
}
var app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
//
app.use(favicon(__dirname + '/public/favicon.ico'));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded());
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use('/', routes);
app.use('/users', users);
// production error handler
// no stacktraces leaked to user
app.use(function(err, req, res, next) {
res.status(err.status || 500);
res.render('error', {
message: err.message,
error: {}
});
});
I'm just getting 'into cmd'' and really enjoy it, so sorry if my syntax/phrasing or anything makes this impossible to sort through in order to give advice (this is my first post to github).
from generator.
@ADC5 you need to put the line var app = express();
above when you first try to use the app
variable (i.e. move that line above /// catch 404 and forwarding to error handler
).
from generator.
@dougwilson Thanks for that doug! But when I call npm start it gives me another set of errors:
rfs.js.:797
return binding.stat(pathModule._makeLong(path));
Error: ENOENT, no such file or directory 'filepath'
at Error (native)
at Object.fs.statsSync (fs.js:797:18)
at favicon ('path to favicon')
at Object.<anonymous> (C:\node\nodetest\app.js:49:9)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:365:17)
at Module.require (module.js.:365:17)
at require (module.js:384:17)
And then the rest of the ERR! statements are the same. Any other ideas? Also, is there a way to copy the text from node.js so I don't have to type it completely out each time? Thanks again for the help!
from generator.
@ADC5 it's because you do not have a file at public/favicon.ico
. You either need to put one there, or comment out that line.
from generator.
I tried that and it gave me:
body-parser deprecated undefined extended option app.js
C:\node\node\nodetest\bin\www:16 (line 16 is blank in app.js)
aopp.set('port', port);
from generator.
app.set('port',port);
Sorry, accidently sent that while I was finishing it. Could that mean I have a server connection issue>
from generator.
and I forgot the @dougwilson : 2 previous posts
from generator.
@ADC5 I'm happy to help more, but please, let's stop filling the dozen people in this old thread's email inboxes. Please create a new issue here: https://github.com/expressjs/generator/issues/new
from generator.
Related Issues (20)
- Opinionless, minimalist variant HOT 4
- Should the node version < 6 be opted out in travis.yml ? HOT 3
- bash: express: command not found... HOT 3
- fix lodash vulnerability HOT 2
- is this still maintaining? HOT 1
- CORS HOT 1
- Include .gitignore file as part of the initial project setup HOT 1
- myapp HOT 1
- Instructions on how to compile the css engines HOT 4
- option to generate mjs HOT 1
- Recommending nodemon instead of npm start.
- Sass Generator not working out of the box HOT 1
- To bump `pug` to latest >3.x.x
- To automate maintenance of dependency versions in `express-cli.js` HOT 3
- EACCES: permission denied HOT 1
- Dire need for a major update/overhaul HOT 5
- Is express-generator is deprecated or out of maintenance? HOT 1
- Running tests locally fails
- sass instead of node-sass
- Fork adding support for ES modules HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from generator.