I'm creating a Node.js application using Express. Normally, to run the application locally, I type in node app.js, and everything works fine. However, now I'm using a book to learn how to create express apps, and it asked me to create a bin/www file that has the following in it:
#!/usr/bin/nodejs
var debug = require('debug')('my-application');
var app = require('../app');
app.set('port', process.env.PORT || 3000);
var server = app.listen(app.get('port'), function() {
debug('Express server listening on port ' + server.address().port);
});
The book also asked me to install nodemon to run the application. However, everytime I use npm start or nodemon to start the application, I get the error:
'nodejs' is not recognized as an internal or external command
The Environment variables are correctly set, I've double checked.
Here is the 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 npm#2.15.8
3 info using node#v4.4.7
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart application-name#0.0.1
6 info start application-name#0.0.1
7 verbose unsafe-perm in lifecycle true
8 info application-name#0.0.1 Failed to exec start script
9 verbose stack Error: application-name#0.0.1 start: `nodejs ./bin/www`
9 verbose stack Exit status 1
9 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:217:16)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:827:16)
9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid application-name#0.0.1
11 verbose cwd C:\Users\Humad\Dropbox\projects\loc8r
12 error Windows_NT 10.0.14393
13 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error node v4.4.7
15 error npm v2.15.8
16 error code ELIFECYCLE
17 error application-name#0.0.1 start: `nodejs ./bin/www`
17 error Exit status 1
18 error Failed at the application-name#0.0.1 start script 'nodejs ./bin/www'.
18 error This is most likely a problem with the application-name package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error nodejs ./bin/www
18 error You can get information on how to open an issue for this project with:
18 error npm bugs application-name
18 error Or if that isn't available, you can get their info via:
18 error
18 error npm owner ls application-name
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
As you seem to already know (by typing node app.js), the Node process on Windows is node, not nodejs.
Change your start command in package.json to the right command.
Related
I got the project from the Heroku startup guide and deployed it successfully. However when I try to run it locally I'm faced with this error:
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 npm#2.15.5
3 info using node#v4.4.5
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart MEAN#1.0.0
6 info start MEAN#1.0.0
7 verbose unsafe-perm in lifecycle true
8 info MEAN#1.0.0 Failed to exec start script
9 verbose stack Error: MEAN#1.0.0 start: `node server.js`
9 verbose stack Exit status 1
9 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:217:16)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:827:16)
9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid MEAN#1.0.0
11 verbose cwd C:\Users\kmagl\Documents\CuttingEdge\new-project4
12 error Windows_NT 10.0.10586
13 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error node v4.4.5
15 error npm v2.15.5
16 error code ELIFECYCLE
17 error MEAN#1.0.0 start: `node server.js`
17 error Exit status 1
18 error Failed at the MEAN#1.0.0 start script 'node server.js'.
18 error This is most likely a problem with the MEAN package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error node server.js
18 error You can get information on how to open an issue for this project with:
18 error npm bugs MEAN
18 error Or if that isn't available, you can get their info via:
18 error
18 error npm owner ls MEAN
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
I would love some help on this. I and some other people are having trouble at this point.
Make sure you've run npm install locally, and that you have an environment variable named MONGODB_URI that has a valid URL to a running mongodb instance.
Also, if you call node server.js from the command line, you may find more verbose logging to help you narrow down the problem; the one npm emits is usually pretty opaque.
I am .net developer.Previous developer used nodeJS and react for one project.I must complete that project.That project use nodeJS,and reactJS.I installed NodeJS in windows 8
I install packages(npm install) it worked well.But now I try to run-start project but it give error
When I write npm start it give that error
Failed at the react-seed #0.0.13 start script node_env=development node dev-server .webpack/config
here is log file
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 npm#2.14.20
3 info using node#v4.4.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart react-seed#0.0.13
6 verbose unsafe-perm in lifecycle true
7 info start react-seed#0.0.13
8 verbose unsafe-perm in lifecycle true
9 info react-seed#0.0.13 Failed to exec start script
10 verbose stack Error: react-seed#0.0.13 start: `NODE_ENV=development node dev-server ./webpack/config`
10 verbose stack Exit status 1
10 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:214:16)
10 verbose stack at emitTwo (events.js:87:13)
10 verbose stack at EventEmitter.emit (events.js:172:7)
10 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
10 verbose stack at emitTwo (events.js:87:13)
10 verbose stack at ChildProcess.emit (events.js:172:7)
10 verbose stack at maybeClose (internal/child_process.js:827:16)
10 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
11 verbose pkgid react-seed#0.0.13
12 verbose cwd C:\nodeAQ
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 v4.4.1
16 error npm v2.14.20
17 error code ELIFECYCLE
18 error react-seed#0.0.13 start: `NODE_ENV=development node dev-server ./webpack/config`
18 error Exit status 1
19 error Failed at the react-seed#0.0.13 start script 'NODE_ENV=development node dev-server ./webpack/config'.
19 error This is most likely a problem with the react-seed package,
19 error not with npm itself.
19 error Tell the author that this fails on your system:
19 error NODE_ENV=development node dev-server ./webpack/config
19 error You can get information on how to open an issue for this project with:
19 error npm bugs react-seed
19 error Or if that isn't available, you can get their info via:
19 error
19 error npm owner ls react-seed
19 error There is likely additional logging output above.
20 verbose exit [ 1, true ]
I installed the replay starter kit on my windows 10 machine, but I get errors after "npm start." The key failure seems to be at 'babel-node ./server.js'.
Here's my npm debug log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files (x86)\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm#2.11.2
3 info using node#v0.12.5
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart relay-starter-kit#0.1.0
6 info start relay-starter-kit#0.1.0
7 verbose unsafe-perm in lifecycle true
8 info relay-starter-kit#0.1.0 Failed to exec start script
9 verbose stack Error: relay-starter-kit#0.1.0 start: `babel-node ./server.js`
9 verbose stack Exit status 1
9 verbose stack at EventEmitter.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\lifecycle.js:213:16)
9 verbose stack at EventEmitter.emit (events.js:110:17)
9 verbose stack at ChildProcess.<anonymous> (C:\Program Files (x86)\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack at ChildProcess.emit (events.js:110:17)
9 verbose stack at maybeClose (child_process.js:1015:16)
9 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
10 verbose pkgid relay-starter-kit#0.1.0
11 verbose cwd C:\Users\Polisander\Code\miles-relay
12 error Windows_NT 6.3.9600
13 error argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error node v0.12.5
15 error npm v2.11.2
16 error code ELIFECYCLE
17 error relay-starter-kit#0.1.0 start: `babel-node ./server.js`
17 error Exit status 1
18 error Failed at the relay-starter-kit#0.1.0 start script 'babel-node ./server.js'.
18 error This is most likely a problem with the relay-starter-kit package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error babel-node ./server.js
18 error You can get their info via:
18 error npm owner ls relay-starter-kit
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
2 info using npm#2.11.3
3 info using node#v0.12.7
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart telcodna#0.0.0
6 info start telcodna#0.0.0
7 verbose unsafe-perm in lifecycle true
8 info telcodna#0.0.0 Failed to exec start script
9 verbose stack Error: telcodna#0.0.0 start: `node ./bin/www`
9 verbose stack Exit status 1
9 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:213:16)
9 verbose stack at EventEmitter.emit (events.js:110:17)
9 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:24:14)
9 verbose stack at ChildProcess.emit (events.js:110:17)
9 verbose stack at maybeClose (child_process.js:1015:16)
9 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
10 verbose pkgid telcodna#0.0.0
11 verbose cwd /usr/local/node-v0.12.7/telcodna
12 error Linux 3.19.0-26-generic
13 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
14 error node v0.12.7
15 error npm v2.11.3
16 error code ELIFECYCLE
17 error telcodna#0.0.0 start: `node ./bin/www`
17 error Exit status 1
18 error Failed at the telcodna#0.0.0 start script 'node ./bin/www'.
18 error This is most likely a problem with the telcodna package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error node ./bin/www
18 error You can get their info via:
18 error npm owner ls telcodna
18 error
There is likely additional logging output above.
enter code here
19 verbose exit [ 1, true
Please suggest me on this issue.
If you are using nodejs command instead of node command this error can occur if any dependency uses node command.
It enters exit status after executing start script :
8 info telcodna#0.0.0 Failed to exec start script
9 verbose stack Error: telcodna#0.0.0 start: `node ./bin/www`
9 verbose stack Exit status 1
You can create symlink with that command on terminal:
sudo ln -s which nodejs /usr/bin/node
I prefer you install node.js on ubuntu with nvm. Also you will be able to have control node versions.
When I ran npm start a few months ago, everything worked fine. Now npm start hangs and says the error message in the picture. The file is there though when I followed the breadcrumbs so the error isn't helpful nor correct. I tried to follow this StackOverflow question
and update everything but it still hangs. I have put the npm-debug.log below. Googling the error exit status did not bear fruit either. Any ideas?
The following comes from npm-debug.log (hopefully it helps cause I'm lost):
0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli 'C:\\Users\\Michael\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm#2.11.1
3 info using node#v0.12.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart flapper-news#0.0.0
6 info start flapper-news#0.0.0
7 verbose unsafe-perm in lifecycle true
8 info flapper-news#0.0.0 Failed to exec start script
9 verbose stack Error: flapper-news#0.0.0 start: `node ./bin/www`
9 verbose stack Exit status 3221225786
9 verbose stack at EventEmitter.<anonymous> (C:\Users\Michael\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:213:16)
9 verbose stack at EventEmitter.emit (events.js:110:17)
9 verbose stack at ChildProcess.<anonymous> (C:\Users\Michael\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack at ChildProcess.emit (events.js:110:17)
9 verbose stack at maybeClose (child_process.js:1015:16)
9 verbose stack at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
10 verbose pkgid flapper-news#0.0.0
11 verbose cwd C:\Users\Michael\Desktop\flapper-news
12 error Windows_NT 6.3.9600
13 error argv "node" "C:\\Users\\Michael\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error node v0.12.4
15 error npm v2.11.1
16 error code ELIFECYCLE
17 error flapper-news#0.0.0 start: `node ./bin/www`
17 error Exit status 3221225786
18 error Failed at the flapper-news#0.0.0 start script 'node ./bin/www'.
18 error This is most likely a problem with the flapper-news package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error node ./bin/www
18 error You can get their info via:
18 error npm owner ls flapper-news
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]