#npm WARN config production Use `--omit=dev`

1 messages · Page 1 of 1 (latest)

grim girder
#

I am trying to deploy my project but I get this error which is causing a 404, altough the build is said to be successfully deployed. I tried googling around but could not find a solution to this. The project is using React Vite.

"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"dev": "vite",
"build": "vite build",
"lint": "eslint src --ext js,jsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"start": "serve build -s -n -L -p $PORT"
},

narrow pelicanBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

crystal questBOT
#

Project ID: e6b14601-7b29-4d0d-af69-40fa8db9da30

grim girder
#

e6b14601-7b29-4d0d-af69-40fa8db9da30

wide compass
#

use serve dist ... instead since vite builds into a folder called dist

grim girder
#

"start": "serve dist-s -n -L -p $PORT"

#

Like this?

wide compass
#

yeah that looks right

grim girder
#

Nope, the warning is still there. But the project is deployed now so all good! Also, didn't notice that dist was added to git ignore by default and I had to remove it.

wide compass
#

you absolutely do want dist in your .gitignore

#

please put it back into .gitignore, and then delete it from the repo

grim girder
#

It is working now. May I ask why I shouldn't include build in my project. On another react project I can't seem to make things work without uploading the build

wide compass
#

you want railway to generate the dist folder itself so that on every deploy your app is rebuilt, this dist folder is created when railway runs the build script in your package.json, if you do include the dist folder in your repo (please don't) you can run into a whole bunch of cryptic errors like file permission errors

grim girder
#

I see. Thanks

narrow pelicanBOT