While starting a react app via npm start in Vultr I am getting below an error :
Could anyone please advise what is causing this error. I am not getting the error in my local system.
root@automateandmore:~/automatemore# npm start
[email protected] start react-scripts start
Invalid options object. Dev Server has been initialized using an options object that does not match the API schema.
- options.allowedHosts[0] should be a non-empty string.
You can build a React project and publish it with Nginx directly on a Vultr VPS. So you don't need to run any nodejs server.
For this, you need to specify the path of the build file created with the
npm buildcommand in the nginx configuration.As for your question, if for some reason you want to publish your site in development mode by running nodejs server with the
npm startcommand; you can add the following to the package.json file.With this code, you allow the running nodejs server to be accessed from any device. Don't forget to run it again with
npm startafter making this addition.I also recommend to read this answer: https://stackoverflow.com/a/47505427/14893142