Vuepress deployment failing on Netlify

Hello, the name of my site is rocket-chat-js-sdk.netlify.app

I am trying to deploy a Vuepress project on Netlify, but I keep getting this error while building:

9:20:43 AM:   Error message
9:20:43 AM:   Command failed with exit code 127: vuepress build src (https://ntl.fyi/exit-code-127)
9:20:43 AM: ​
9:20:43 AM:   Error location
9:20:43 AM:   In Build command from Netlify app:
9:20:43 AM:   vuepress build src
9:20:43 AM: ​
9:20:43 AM:   Resolved config
9:20:43 AM:   build:
9:20:43 AM:     command: vuepress build src
9:20:43 AM:     commandOrigin: ui
9:20:43 AM:     publish: /opt/build/repo/src/.vuepress/dist
9:20:43 AM:     publishOrigin: ui
9:20:43 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
9:20:43 AM: Failing build: Failed to build site
9:20:44 AM: Finished processing build request in 18.032s

I have consulted all known errors on Netlify and the web, and none has worked so far.
Some of my approaches include using a different command from vuepress to yarn and then npm.
I also included a yarn.lock as suggested in one of the forums but it did not change anything.

I consulted the chatbot, and its response, which was my initial build setup, did not work either.

I’d be glad to get help resolving this. Thank you

Building works well locally.

@moerayo Can you supply the full build log, or at the very least “more” of it?

The “exit code” is the end result, it’s not the actual error.

The initialization passed.
The build process starts and then fails. This is the full log:

3:08:38 PM: Netlify Build                                                 
3:08:38 PM: ────────────────────────────────────────────────────────────────
3:08:38 PM: ​
3:08:38 PM: ❯ Version
3:08:38 PM:   @netlify/build 29.36.0
3:08:38 PM: ​
3:08:38 PM: ❯ Flags
3:08:38 PM:   baseRelDir: true
3:08:38 PM:   buildId: 65e735554a9c5e20fba3fda3
3:08:38 PM:   deployId: 65e735554a9c5e20fba3fda5
3:08:38 PM: ​
3:08:38 PM: ❯ Current directory
3:08:38 PM:   /opt/build/repo
3:08:38 PM: ​
3:08:38 PM: ❯ Config file
3:08:38 PM:   No config file was defined: using default values.
3:08:38 PM: ​
3:08:38 PM: ❯ Context
3:08:38 PM:   production
3:08:38 PM: ​
3:08:38 PM: Build command from Netlify app                                
3:08:38 PM: ────────────────────────────────────────────────────────────────
3:08:38 PM: ​
3:08:38 PM: $ vuepress build src
3:08:38 PM: bash: vuepress: command not found
3:08:38 PM: ​
3:08:38 PM: "build.command" failed                                        
3:08:38 PM: ────────────────────────────────────────────────────────────────
3:08:38 PM: ​
3:08:38 PM:   Error message
3:08:38 PM:   Command failed with exit code 127: vuepress build src (https://ntl.fyi/exit-code-127)
3:08:38 PM: ​
3:08:38 PM:   Error location
3:08:38 PM:   In Build command from Netlify app:
3:08:38 PM:   vuepress build src
3:08:38 PM: ​
3:08:38 PM:   Resolved config
3:08:38 PM:   build:
3:08:38 PM:     command: vuepress build src
3:08:38 PM:     commandOrigin: ui
3:08:38 PM:     publish: /opt/build/repo/src/.vuepress/dist
3:08:38 PM:     publishOrigin: ui
3:08:39 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:08:39 PM: Failing build: Failed to build site
3:08:39 PM: Finished processing build request in 21.74s
3:08:39 PM: Failed during stage "building site": Build script returned non-zero exit code: 2

It says it cannot find vuepress.

Here is also an image of my configuration:

@moerayo As I’d suspected, (but couldn’t see in the original details), it cannot find vuepress:

3:08:38 PM: $ vuepress build src
3:08:38 PM: bash: vuepress: command not found

Double check your dependencies and package.json etc and make sure that vuepress is specified.

Hello @nathanmartin thank you, but I have that already, and I just upgraded the package

Screenshot 2024-03-06 at 08-34-18 rocket.chat-js-sdk_docs_package.json at main · MoeRayo_rocket.chat-js-sdk

@moerayo Have you tried moving it to dependencies?

See the note here which may apply to your situation:
https://docs.netlify.com/configure-builds/manage-dependencies/#node-js-environment

Also make sure that your package.json is in the Base directory:
https://docs.netlify.com/configure-builds/overview/#definitions