About starting, restarting and stopping the node instance

Hello VSF peple!
I am new to this whole nodejs thing. I have used it before but not in this scale.

My problem is that I don’t understand how vsf installer runs the vsf app even though I have looked at the installer code and thus I don’t know how I can stop it, so that my localhost:3000 port is available again. I don’t know how I can start it from a stopped state etc.

Also, if I have two vsf projects locally and I want to switch between them, how can I do it?

What I have tried:

  1. yarn help
  2. npm run start, which starts a new instance on localhost:3001
  3. Reading about pm2. I tried shutting off some instances but the 3000 port is still bussy.
  4. Reading docs and online tutorials without success

I am very interested in learning how it works, so I hope you can help me, thanks!

Hi,

Try node killall to stop the processes started by the installer.

After that, within the vue-storefront directory, run yarn dev to run in development mode and ctrl+c to stop it.

For production mode, run yarn build after any changes, then yarn start to start it. It can be restarted any time by running yarn start again. To stop all instances use yarn pm2 stop all. If you make changes to pm2 or want to run a different installation, you need to use yarn pm2 kill.

To run 2 installations in dev mode, change the port number of one of them in local.json. By default it’s 3000, so change one to 3001 or something.

I hope that helps

1 Like

Thank you @grimasod Now it is perfectly clear to me.

Great. Also useful when running in production mode - yarn pm2 list to see what processes are running and yarn pm2 logs to view the live logs, ctrl+c to exit

I don’t know how the docs work (https://docs.vuestorefront.io/)
But I think it might be useful to add some of this information to the section for installing on linux/mac/win
It could have saved me a few days of searching for this since it was so new to me :smile:

Good point @pupolajshu -> @kkdg wouldd you be so kind and fix it by first chance? :slight_smile:

sure thing, very much interesting topic for people just started