Nodejs ./bin/www script not running on startup

node ./bin/www not working
express-generator es6
npm start not working
nodejs bin folder
express project structure
node js scaffolding
express-generator-typescript
bin/www does not exist

I'm learning node.js. I setup node and express on my machine. Then I used express auto project generator to setup a basic project. I could see my localhost:3000 page. But then something happened and it suddenly stopped working (obviously im not sure what happend).

I tried debugging and adding some console statements. It turns out ./bin/www file which is supposed to run on start up (specified in package.json) is not getting executed at all.

If I just add these 2 lines of code from ./bin/www to my app.js file everything seems to work fine.

var port = (process.env.PORT || '3000');
app.listen(port);

So I think culprit is bin/www file but I'm not sure why it is not getting executed at all?

In my package.json file I have this

  "scripts": {
    "start": "node ./bin/www"
  },

Let me know if I should be posting any other information that can be helpful.

Modify the scripts to:

"scripts": {
    "start": "node ./bin/www/app.js"
  },

and then use the command npm start Hope that helps!

javascript - Nodejs ./bin/www script not running on startup, Modify the scripts to: "scripts": { "start": "node ./bin/www/app.js" },. and then use the command npm start Hope that helps! node-startup. Startup script for Linux-based systems for running a Node.js app when rebooting, using an /etc/init.d script.. Looking for a maintainer. If you use node-startup and would like to be a maintainer, send me a message.

It seems that you have not started node server. Try adding following in app.js :

app.set('port', process.env.PORT || 3000);

var server = app.listen(app.get('port'), function () {
    console.log('server listening on port ' + server.address().port);
});

Now start your server using node app

Why did the startup stub get moved to bin/www ? · Issue #25 , app') from external files and get the express app that is not listening The bin/​www is a valid JavaScript file node.js can run. npm and npm install -g it, because npm will wrap that bin/www script into a .cmd file on Windows. Synology NAS - How to make a program run at startup: The other day I created a little node.js project to keep track of some finances. Synology has a node.js package but that just installs the tools - it has no 'container' or any other support to drop files and have it run automagically.

After using npm start if the terminal shows >node ./bin/www than it means your server is already running. It will work just fine. Just manually paste: http://localhost:3000/ on your browser. You will get the braintree drop-in UI as expected.

express js fail, after npm start · Issue #31 · expressjs/generator · GitHub, bin/www` npm ERR! Exit status 8 npm ERR! npm ERR! Failed at the express@​0.0.1 start script. npm ERR! This is most likely a problem with the  I've bee reading about running scripts at startup since last weak with no results. I just need to run an application located on my home (/home/pi) at startup (unattended). I tried creating a script

set DEBUG=your_directory_name:* & npm start

Express Tutorial Part 2: Creating a skeleton website, Note: The Express Application Generator is not the only generator for "express-​locallibrary-tutorial:*"; npm start run the app (Command bin/www express-​locallibrary-tutorial:server Listening on port 3000 It also defines a startup script that will call the application entry point, the JavaScript file /bin/www. { "scripts": { "start": "node app.js"} }, Replace "node app.js" with whatever you use to start your app. Do this for every app you work on. Next time you need to fire up your app, just do this: npm start That's it. Now your startup is the same across all apps and you never have to think about any ridiculous mishmash of commands and flags.

Setting up a Node development environment, You now have a Node development environment up and running on your computer that We'll explain our code in greater detail once we start using Express! in your package.json files and call NPM to execute them with the run-​script command. bin/www helloworld:server Listening on port 3000 +0ms. So now our react and node js both are working, but they are not connected, both react and node js cannot do communication. Here we work on the proxy part which will work of linking our react and node js projects. So back to our terminal => hello_fullstack directory. npm init -y It will create a package.json file.

start-server-and-test, Starts server, waits for URL, then runs test command; when the tests end, shuts down server. Because npm scripts execute with ./node_modules/.bin in the $​PATH , you can mix global and locally installed tools when using  Failed at the nodetest@0.0.0 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:

Can't get "npm start" command to work. : node, When I type "npm start", the application doesn't run. 'C:\\Program Files\\nodejs\\​node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'start' ] 2 info node symlink C​:\Program Files\nodejs\\node.exe 5 verbose run-script [ 'prestart', 'start', using the command "node app.js", but I'm curious as to why "npm start" isn't working. I've been searching a while how to run a Node.js program at the boot of my Raspberry Pi and only one technique worked for me. Moreover I found it very simple! forever and forever-service Basically, what you have to do is make your program a service and then run the service automatically at the startup.

Comments
  • how are you running app? using npm start or node app.js
  • by running command node app.js
  • what is the difference between those 2? I have never heard anything about npm start
  • If there is .bin/www in your applicaion that means you are using Express 4.0 . In case of Express 3.0 we need to run command 'node app.js' but in case of Express 4.0 we need to run command 'npm start' to run nodeJS application. So , here seems you are using Express 4.0, so run your application through 'npm start'
  • yes running npm start instead of node app.js worked, can you please explain why and what is the difference between the two?
  • npm start calls node to execute a file. You created app.js in ./bin/www folder. When you say node <directory>, the javascript file that you want to run MUST be named index.js, if you want to run the javascript file that is not named index.js, you have to run the file as node <file name>.
  • Hi, welcome to StackOverflow. Please edit your answer to provide some narrative about how it answers the question. Thanks.