Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

toniperic's avatar

If you just do npm install express it'll install it to /path/to/app/node_modules/express, but won't save it to dependencies list (which can be found at /path/to/app/package.json).

If you add a --save flag when executing the command it'll add it to the list too, much like composer require package-name does with composer.json.

So in the tutorial it isn't mentioned you need "express" library but by looking at the socket.js example code, you can see at the top it's required:

var app = require('express')();
1 like
mstnorris's avatar

@toniperic I had already added the --save flag so that's good. Just wanted to confirm so I can put this workflow together. If you're happy to, and you'd like me to then I'll put something up on here much like I did with the Guidelines for posting on Laracasts.com and I'll mention you too.

toniperic's avatar

Yeah, but be cautious with --save. Use it only for stuff you'd probably want on your production server too. For development stuff (like gulp-notify, gulp-sass etc) you'd want to use --save-dev flag, as there's no point having those tools on your production server. Ideally, you'd want to be able to move project to production server and just run npm install and everything will work and all of your dependencies will be installed from package.json file.

Sure thing, go ahead. Usually Google will lead users to this thread most likely, but having a brief summary would be nice.

mstnorris's avatar

Do I need to do anything specific on my server to keep the connection open for Redis and Socket.io?

toniperic's avatar

@mstnorris in combination with these, I'd just use Supervisord to supervise everything, so once it's down, and eventually it will run out of memory, Supervisord will just re-start the processes.

Other than that I don't think so, no.

mstnorris's avatar

I've never used Supervisord. Do you know if it is installed by default through Forge?

Previous

Please or to participate in this conversation.