Question

I am new to node. I am trying to run an express server. I get no errors when installing express but when i run npm start or node app (as all the beginner tutorials point) nothing seems to be happening. The only way i can start the server is by typing node /bin/www. My operating system is Windows. Any advice?

Was it helpful?

Solution 2

I managed to solve my issue by changing the code page of cmd-dos. By using chcp 850 or chcp 65001 in cmd thus changing codepage to latin - utf8 the issue is gone.

OTHER TIPS

The Express scaffold script generates a package.json file with a start script field that points to the app.js file it also created. Since Express 4 was released the scaffold generator script has been moved to its own package. https://github.com/expressjs/generator

All npm start does is look in the package.json file for a starting script to pass to node. You can see this in the documentation.

Running npm start with a package.json like this:

"scripts": {
    "start": "app.js"
}

Is exactly equivalent to running node app.js.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top