Deploy failed with exit code 127: remix vite:build

Hello everyone,

I just created a small Vite/React app and put it on Github. I just tried to deploy it with Netlify with default settings but got this error during the build phase :

11:47:03 AM: Netlify Build                                                 
11:47:03 AM: ────────────────────────────────────────────────────────────────
11:47:03 AM: ​
11:47:03 AM: ❯ Version
11:47:03 AM:   @netlify/build 29.54.6
11:47:03 AM: ​
11:47:03 AM: ❯ Flags
11:47:03 AM:   accountId: 5f9681c81080498d848cbd72
11:47:03 AM:   baseRelDir: true
11:47:03 AM:   buildId: 66fbc4f110ed25f7fec5d445
11:47:03 AM:   deployId: 66fbc4f110ed25f7fec5d447
11:47:03 AM: ​
11:47:03 AM: ❯ Current directory
11:47:03 AM:   /opt/build/repo
11:47:03 AM: ​
11:47:03 AM: ❯ Config file
11:47:03 AM:   No config file was defined: using default values.
11:47:03 AM: ​
11:47:03 AM: ❯ Context
11:47:03 AM:   production
11:47:03 AM: ​
11:47:03 AM: Build command from Netlify app                                
11:47:03 AM: ────────────────────────────────────────────────────────────────
11:47:03 AM: ​
11:47:03 AM: $ remix vite:build
11:47:03 AM: bash: remix: command not found
11:47:03 AM: ​
11:47:03 AM: "build.command" failed                                        
11:47:03 AM: ────────────────────────────────────────────────────────────────
11:47:03 AM: ​
11:47:03 AM:   Error message
11:47:03 AM:   Command failed with exit code 127: remix vite:build (https://ntl.fyi/exit-code-127)
11:47:03 AM: ​
11:47:03 AM:   Error location
11:47:03 AM:   In Build command from Netlify app:
11:47:03 AM:   remix vite:build
11:47:03 AM: ​
11:47:03 AM:   Resolved config
11:47:03 AM:   build:
11:47:03 AM:     command: remix vite:build
11:47:03 AM:     commandOrigin: ui
11:47:03 AM:     publish: /opt/build/repo/dist/client
11:47:03 AM:     publishOrigin: ui
11:47:03 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:47:04 AM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
11:47:04 AM: Failing build: Failed to build site
11:47:04 AM: Finished processing build request in 19.837s

I have several apps deployed here so the connection with my Github account is fine. This my first app using Vite though.
What is causing this fail and how could I solve it ?

@Floran The error is:

So your build command is remix vite:build and it doesn’t know what remix is.

Usually this happens when a package isn’t set correctly in your dependencies.
E.g. If remix was an npm package and wasn’t in your package.json

Maybe you mean for your build command to be npx remix vite:build?

If you haven’t seen it, Netlify’s Remix documentation is here:

1 Like

Thank you for your answer ! Unfortunately, I tried different things here but nothing worked. I tried netlify-cli for the first time and it worked perfectly !

Great, whatever works :person_shrugging:

Super happy the netlify-cli worked. Odd that it had issues deploying though :thinking: