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
Dong Lam TrienPosted Apr 12, 2024, 8:43 AM
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.
Abhishek YadavPosted Apr 12, 2024, 4:18 AM
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:
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.