Vuepress + netlify build error

Hi, I’m trying to deploy a vuepress site via netlify but im getting a build error

Site name = lovely-madeleine-5e1efa

build error

2:35:39 PM: Netlify Build                                                 
2:35:39 PM: ────────────────────────────────────────────────────────────────
2:35:39 PM: ​
2:35:39 PM: ❯ Version
2:35:39 PM:   @netlify/build 29.12.1
2:35:39 PM: ​
2:35:39 PM: ❯ Flags
2:35:39 PM:   baseRelDir: true
2:35:39 PM:   buildId: 64878f932158371c958dbe11
2:35:39 PM:   deployId: 64878f932158371c958dbe13
2:35:39 PM: ​
2:35:39 PM: ❯ Current directory
2:35:39 PM:   /opt/build/repo
2:35:39 PM: ​
2:35:39 PM: ❯ Config file
2:35:39 PM:   No config file was defined: using default values.
2:35:39 PM: ​
2:35:39 PM: ❯ Context
2:35:39 PM:   production
2:35:39 PM: ​
2:35:39 PM: Build command from Netlify app                                
2:35:39 PM: ────────────────────────────────────────────────────────────────
2:35:39 PM: ​
2:35:39 PM: $ yarn dev
2:35:39 PM: yarn run v1.22.19
2:35:39 PM: $ vuepress dev src
2:35:40 PM: wait Extracting site metadata...
2:35:40 PM: Error: Cannot resolve theme: default-prefers-color-scheme.
2:35:40 PM:     at resolveTheme (/opt/build/repo/node_modules/@vuepress/core/lib/node/loadTheme.js:111:13)
2:35:40 PM:     at loadTheme (/opt/build/repo/node_modules/@vuepress/core/lib/node/loadTheme.js:36:17)
2:35:40 PM:     at App.process (/opt/build/repo/node_modules/@vuepress/core/lib/node/App.js:105:21)
2:35:40 PM:     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2:35:40 PM:     at async dev (/opt/build/repo/node_modules/@vuepress/core/lib/index.js:17:3)
2:35:40 PM: error Command failed with exit code 1. (https://ntl.fyi/exit-code-1)
2:35:40 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
2:35:40 PM: ​
2:35:40 PM: "build.command" failed                                        
2:35:40 PM: ────────────────────────────────────────────────────────────────
2:35:40 PM: ​
2:35:40 PM:   Error message
2:35:40 PM:   Command failed with exit code 1: yarn dev (https://ntl.fyi/exit-code-1)
2:35:40 PM: ​
2:35:40 PM:   Error location
2:35:40 PM:   In Build command from Netlify app:
2:35:40 PM:   yarn dev
2:35:40 PM: ​
2:35:40 PM:   Resolved config
2:35:40 PM:   build:
2:35:40 PM:     command: yarn dev
2:35:40 PM:     commandOrigin: ui
2:35:40 PM:     publish: /opt/build/repo/.vuepress/dist
2:35:40 PM:     publishOrigin: ui
2:35:42 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
2:35:42 PM: Failing build: Failed to build site
2:35:42 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
2:35:43 PM: Finished processing build request in 25.958s

github repo = https://github.com/yavda1/docs
build settings

@yavda1 While you’ve seen this occur on Netlify, it just seems to be an issue with your project.

When I pull down and run your project locally I get exactly the same error as shown on Netlify:

2:35:40 PM: Error: Cannot resolve theme: default-prefers-color-scheme.
2:35:40 PM:     at resolveTheme (/opt/build/repo/node_modules/@vuepress/core/lib/node/loadTheme.js:111:13)
2:35:40 PM:     at loadTheme (/opt/build/repo/node_modules/@vuepress/core/lib/node/loadTheme.js:36:17)
2:35:40 PM:     at App.process (/opt/build/repo/node_modules/@vuepress/core/lib/node/App.js:105:21)
2:35:40 PM:     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
2:35:40 PM:     at async dev (/opt/build/repo/node_modules/@vuepress/core/lib/index.js:17:3)

You should fix your project, make sure that you can run npm run build locally on your machine without error, and then try again on Netlify.

The error relates to the vuepress theme, which is referenced in src/.vuepress/config.js

theme: 'default-prefers-color-scheme',