So my project structure is as follows:
Project Root
│
├── app/ # Frontend directory
│ ├── public/ # Public assets
│ ├── src/ # Source code
│ ├── server/ # Backend directory (moved inside the frontend directory)
│ │ ├── functions/ # Serverless functions directory
│ │ │ ├── function1.js # Individual serverless functions
│ │ │ ├── function2.js
│ │ │ ├── ...
│ │ ├── package.json # Backend dependencies
│ │ ├── ... # Other backend files and directories
│ ├── package.json # Frontend dependencies
│ ├── ... # Other frontend files and directories
│
├── netlify.toml # Netlify configuration file
└── README.md # Project documentation
I know this structure is a bit disabled, but initially this project was root, and two subdirs, app and server
However netlify requires a base directory which I set as app/ and it requires a functions directory which they force to be inside whatever you set as your base directory. So therefore I moved my server dir inside my app dir.
Problem now is that in the netlify build, it isnt running npm install for the package.json inside server directory
Here are the logs for the build process
10:40:24 PM: Netlify Build
10:40:24 PM: ────────────────────────────────────────────────────────────────
10:40:24 PM:
10:40:24 PM: ❯ Version
10:40:24 PM: @netlify/build 29.41.3
10:40:24 PM:
10:40:24 PM: ❯ Flags
10:40:24 PM: baseRelDir: true
10:40:24 PM: buildId: 663fe5a7bad0a341be052aed
10:40:24 PM: deployId: 663fe5a7bad0a341be052aef
10:40:24 PM:
10:40:24 PM: ❯ Current directory
10:40:24 PM: /opt/build/repo/app
10:40:24 PM:
10:40:24 PM: ❯ Config file
10:40:24 PM: /opt/build/repo/netlify.toml
10:40:24 PM:
10:40:24 PM: ❯ Context
10:40:24 PM: production
10:40:24 PM:
10:40:24 PM: build.command from netlify.toml
10:40:24 PM: ────────────────────────────────────────────────────────────────
10:40:24 PM:
10:40:24 PM: $ npm run build --ignore-warnings
10:40:25 PM: > [email protected] build
10:40:25 PM: > react-scripts build --ignore-warnings
10:40:26 PM: Creating an optimized production build...
10:40:35 PM: One of your dependencies, babel-preset-react-app, is importing the
10:40:35 PM: "@babel/plugin-proposal-private-property-in-object" package without
10:40:35 PM: declaring it in its dependencies. This is currently working because
10:40:35 PM: "@babel/plugin-proposal-private-property-in-object" is already in your
10:40:35 PM: node_modules folder for unrelated reasons, but it may break at any time.
10:40:35 PM: babel-preset-react-app is part of the create-react-app project, which
10:40:35 PM: is not maintianed anymore. It is thus unlikely that this bug will
10:40:35 PM: ever be fixed. Add "@babel/plugin-proposal-private-property-in-object" to
10:40:35 PM: your devDependencies to work around this error. This will make this message
10:40:35 PM: go away.
10:40:43 PM: Compiled with warnings.
10:40:43 PM:
10:40:43 PM: [eslint]
10:40:43 PM: src/StockDetailsPage/Chart/utils.js
10:40:43 PM: Line 155:1: Assign object to a variable before exporting as module default import/no-anonymous-default-export
10:40:43 PM: src/StockDetailsPage/Options/index.js
10:40:43 PM: Line 34:8: React Hook useEffect has a missing dependency: 'price'. Either include it or remove the dependency array react-hooks/exhaustive-deps
10:40:43 PM: Search for the keywords to learn more about each warning.
10:40:43 PM: To ignore, add // eslint-disable-next-line to the line before.
10:40:43 PM: File sizes after gzip:
10:40:43 PM: 132.79 kB build/static/js/main.93092ac4.js
10:40:43 PM: 46.67 kB build/static/css/main.591ccc60.css
10:40:43 PM: The project was built assuming it is hosted at /.
10:40:43 PM: You can control this with the homepage field in your package.json.
10:40:43 PM: The build folder is ready to be deployed.
10:40:43 PM: You may serve it with a static server:
10:40:43 PM: npm install -g serve
10:40:43 PM: serve -s build
10:40:43 PM: Find out more about deployment here:
10:40:43 PM: https://cra.link/deployment
10:40:44 PM:
10:40:44 PM: (build.command completed in 19.1s)
10:40:44 PM:
10:40:44 PM: Functions bundling
10:40:44 PM: ────────────────────────────────────────────────────────────────
10:40:44 PM:
10:40:44 PM: Packaging Functions from server/functions directory:
10:40:44 PM: - history.js
10:40:44 PM: - options.js
10:40:44 PM: - quote.js
10:40:44 PM: - screener.js
10:40:44 PM: - search.js
10:40:44 PM: - suggestions.js
10:40:44 PM:
10:40:49 PM:
10:40:49 PM: (Functions bundling completed in 5.4s)
10:40:49 PM:
10:40:49 PM: (Netlify Build completed in 25s)
10:40:50 PM: Section completed: building
10:40:52 PM: Finished processing build request in 48.216s