Problem deploying my 1st app
Unanswered
Brown bear posted this in #help-forum
Brown bearOP
Hello people, I have a hard time deploying my app.
I always get a 404: NOT_FOUND
Code: NOT_FOUND
It is composed of both the front end (react) and back end (express.js)
the structure of the project is the following.
back-end is in server/src/index.js (module.exports = app; at the end of the file)
front in client/src/index.js
├── README.md
├── client
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── postcss.config.js
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── components
│ │ │ ├── .....
│ │ ├── contexts
│ │ │ ├── ....
│ │ ├── hooks
│ │ │ ├── ....
│ │ ├── imgs
│ │ │ └── logo.png
│ │ ├── index.css
│ │ ├── index.js
│ │ ├── reportWebVitals.js
│ └── tailwind.config.js
├── package-lock.json
├── package.json
├── server
│ ├── package-lock.json
│ ├── package.json
│ └── src
│ └── index.js
└── vercel.json
Thanks so much for your help!
I always get a 404: NOT_FOUND
Code: NOT_FOUND
It is composed of both the front end (react) and back end (express.js)
the structure of the project is the following.
back-end is in server/src/index.js (module.exports = app; at the end of the file)
front in client/src/index.js
├── README.md
├── client
│ ├── README.md
│ ├── package-lock.json
│ ├── package.json
│ ├── postcss.config.js
│ ├── public
│ │ ├── favicon.ico
│ │ ├── index.html
│ │ ├── logo192.png
│ │ ├── logo512.png
│ │ ├── manifest.json
│ │ └── robots.txt
│ ├── src
│ │ ├── App.js
│ │ ├── components
│ │ │ ├── .....
│ │ ├── contexts
│ │ │ ├── ....
│ │ ├── hooks
│ │ │ ├── ....
│ │ ├── imgs
│ │ │ └── logo.png
│ │ ├── index.css
│ │ ├── index.js
│ │ ├── reportWebVitals.js
│ └── tailwind.config.js
├── package-lock.json
├── package.json
├── server
│ ├── package-lock.json
│ ├── package.json
│ └── src
│ └── index.js
└── vercel.json
Thanks so much for your help!
3 Replies
Brown bearOP
the root package.json is the following:
{
"name": "aibets",
"version": "1.0.0",
"private": true,
"scripts": {
"build": "npm run build:client && npm run build:server",
"build:client": "cd client && npm install && CI=false npm run build",
"build:server": "cd server && npm install",
"start": "cd server && npm start"
},
"workspaces": [
"client",
"server"
]
}
and vercel.json:
{
"version": 2,
"builds": [
{ "src": "client/package.json", "use": "@vercel/static-build", "config": { "distDir": "build" } },
{ "src": "server/src/index.js", "use": "@vercel/node" }
],
"routes": [
{ "src": "/api/(.)", "dest": "server/src/index.js" },
{ "src": "^/static/(.)", "dest": "client/build/static/$1" },
{ "handle": "filesystem" },
{ "src": "/(.*)", "dest": "client/build/index.html" }
]
}
{
"name": "aibets",
"version": "1.0.0",
"private": true,
"scripts": {
"build": "npm run build:client && npm run build:server",
"build:client": "cd client && npm install && CI=false npm run build",
"build:server": "cd server && npm install",
"start": "cd server && npm start"
},
"workspaces": [
"client",
"server"
]
}
and vercel.json:
{
"version": 2,
"builds": [
{ "src": "client/package.json", "use": "@vercel/static-build", "config": { "distDir": "build" } },
{ "src": "server/src/index.js", "use": "@vercel/node" }
],
"routes": [
{ "src": "/api/(.)", "dest": "server/src/index.js" },
{ "src": "^/static/(.)", "dest": "client/build/static/$1" },
{ "handle": "filesystem" },
{ "src": "/(.*)", "dest": "client/build/index.html" }
]
}
Spectacled bear
Are you able to create a build and run?
Brown bearOP
When I am doing it in the client folder yes I can. When I have developing the project I always run client and server separately (which worked). Now trying to do both at the same time seems to fail