I am a novice in NodeJS and I am trying to start with express and express-generator. I have installed express with the command:
C:\project>npm install -g express
Then I've installed the express-generator module:
C:\project>npm install -g express-generator
Then I create a folder for the project and install de dependencies:
C:\project\express> nodetest1
C:\project\nodetest1>npm install
Everything works fine there, but the problem appears when I try to start the server, with the command:
C:\project\nodetest1>npm start
It seems that the service starts but it closes as soon as it starts, result:
> nodetest1@0.0.0 start C:\project\nodetest1
> node ./bin/www
C:\project\nodetest1>
When I try to open localhost:3000 it doesn't work. I have search on the net and I haven't found a solution for it, could someone guide me on how to solve this problem?
Thank you.
Update 1:
After having reinstalled node.js and followed the steps proposed below, now I get an error:
C:\wamp\www\mynewapp>npm start
> mynewapp@0.0.0 start C:\wamp\www\mynewapp
> node ./bin/www
npm ERR! mynewapp@0.0.0 start: `node ./bin/www`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the mynewapp@0.0.0 start script.
npm ERR! This is most likely a problem with the mynewapp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can get their info via:
npm ERR! npm owner ls mynewapp
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! cwd C:\wamp\www\mynewapp
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! syscall spawn
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! mynewapp@0.0.0 start: `node ./bin/www`
npm ERR! Exit status -1
npm ERR!
npm ERR! Failed at the mynewapp@0.0.0 start script.
npm ERR! This is most likely a problem with the mynewapp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can get their info via:
npm ERR! npm owner ls mynewapp
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! cwd C:\wamp\www\mynewapp
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! C:\wamp\www\mynewapp\npm-debug.log
npm ERR! not ok code 0
C:\wamp\www\mynewapp>