Reputation: 12011
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.
Upvotes: 1
Views: 949
Reputation: 153
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 build
command 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 start
command; you can add the following to the package.json file.
"devServer": {
"allowedHosts": "all"
}
With this code, you allow the running nodejs server to be accessed from any device. Don't forget to run it again with npm start
after making this addition.
I also recommend to read this answer: https://stackoverflow.com/a/47505427/14893142
Upvotes: 0