When running the React Native application, in this application folder, open cmd and type: Node server.js to connect to the sql server data. Next, open Visual Studio Code and run the npm start command, if you run the npm start command without running the command before. Node server.js will report a data connection error. Can you declare the node server.js command to run before running the npm start command ?
Loading

Abhishek YadavRank #217 · 11.3K reputationPosted Apr 12, 2024, 12:18 AM EDT
Yes, you can declare the node server.js command to run before running the npm start command by specifying it as a prestart script in the package.json file of your React Native application.
To do this, open the package.json file in your project folder and add a "prestart" script under the "scripts" section like so:
"scripts": { "prestart": "node server.js", "start": "npm start" }Now, when you run the npm start command, it will first execute the node server.js command to establish the data connection before starting the React Native application.
Dong Lam TrienRank #1,537 · 1K reputationPosted Apr 12, 2024, 4:43 AM EDT
Hi Abhishek Yadav!
According to your instructions, when running it, the QR code does not appear to run the real machine. You can see it output like this
Can you fix it ? When I type npm start, when I run it, it outputs a QR code so I can scan the phone code to see how the application runs.
D:\login> npm start ... ... › Using Expo Go › Press s ¦ switch to development build › Press a ¦ open Android › Press w ¦ open web › Press j ¦ open debugger › Press r ¦ reload app › Press m ¦ toggle menu › Press o ¦ open project code in your editor › Press ? ¦ show all commands Logs for your project will appear below. Press Ctrl+C to exit.