0

So I have created a React application locally, everything works In the root of this project is a typical server.js file with express .js endpoints that makes use of localhost:5000 via Nodemon 'npm run dev'. when I run react build I get a production build for deployment. I then published it on an IIS Server under E:\Projects\Build and created an application pool. I then created a DNS record and added the binds to the application. It's running at support.genee-group.com but there is no functionality i.e. cannot connect to SQL server database even though I have created a config file. Secondly when I go to the root of the folder : E:\Projects\Build where server.js is i run node server.js to start the proxy part so that i can test if endpoints are working instead i get the ERROR: Cannot find module './src/dbFiles/dbOperations'. I know it cannot find the file above because the build folder structure is different and does not include those directories. So I am confused. My config file is also trying to connect from IIS Server to SQL Server and I think it maybe wrong.

So this is the structure of my project, not the best but works locally. local development structure working

project structure https://i.stack.imgur.com/A7oW3.png

This is the build folder up on the IIS Server at: E:\Projects\build and when I try to run the node server.js I get this error:

this is the error in the root dir of my project on IIS Server: https://i.stack.imgur.com/8RkTm.png

This is also my config file that is trying to connect to SQL server:

const config = {

    user: 'user',
    password:'password123',
    server: '14.0.1000.169',
    port: 1433,
    database: 'Product',
    driver: 'msnodesqlv8',
        options:{
           
            trustedConnection: true,
            
        }

    }

module.exports = config;```


 
Adil arif
  • 11
  • 3
  • Perhaps the discussion of community members under this question can help you: https://stackoverflow.com/questions/9023672/how-do-i-resolve-cannot-find-module-error-using-node-js – TengFeiXie Apr 04 '23 at 10:04

0 Answers0