Hello everyone!
Im getting an error when deploying my site to netlify. I added React Router to my React App and i think after adding it, it broke the deployment.
Its not able to resolve some paths but i dont know. It works on my local machine when i run npm run dev.
Ive got a main.jsx file in the src folder and a pages folder aswell as a components folder.
The pages folder includes:
- home.jsx
- faq.jsx
- error.jsx
The components folder includes:
- footer.jsx
- form.jsx
- navbar.jsx
- pageload.jsx
Error Log:
11:30:36 AM: build-image version: fcb0c1b3ada6d25c1cb58e8bc514f5f23cc14f15 (focal)
11:30:36 AM: buildbot version: ee2ef905a4bdb64f7733dd60a718aa00319e6f82
11:30:37 AM: Fetching cached dependencies
11:30:37 AM: Failed to fetch cache, continuing with build
11:30:37 AM: Starting to prepare the repo for build
11:30:37 AM: No cached dependencies found. Cloning fresh repo
11:30:37 AM: git clone --filter=blob:none GitHub - meisteraxel/rohmilch-kaufen.de
11:30:37 AM: Preparing Git Reference refs/heads/main
11:30:39 AM: Starting to install dependencies
11:30:41 AM: Python version set to 3.8
11:30:41 AM: Attempting Ruby version 2.7.2, read from environment
11:30:42 AM: Using Ruby version 2.7.2
11:30:43 AM: Started restoring cached go cache
11:30:43 AM: Finished restoring cached go cache
11:30:44 AM: go version go1.19.13 linux/amd64
11:30:45 AM: Using PHP version 8.0
11:30:46 AM: Downloading and installing node v18.20.2β¦
11:30:46 AM: Downloading https://nodejs.org/dist/v18.20.2/node-v18.20.2-linux-x64.tar.xzβ¦
11:30:47 AM: Computing checksum with sha256sum
11:30:47 AM: Checksums matched!
11:30:49 AM: Now using node v18.20.2 (npm v10.5.0)
11:30:49 AM: Enabling Node.js Corepack
11:30:49 AM: Started restoring cached build plugins
11:30:49 AM: Finished restoring cached build plugins
11:30:49 AM: Started restoring cached corepack dependencies
11:30:49 AM: Finished restoring cached corepack dependencies
11:30:49 AM: No npm workspaces detected
11:30:49 AM: Started restoring cached node modules
11:30:49 AM: Finished restoring cached node modules
11:30:49 AM: Installing npm packages using npm version 10.5.0
11:30:53 AM: added 365 packages, and audited 366 packages in 4s
11:30:53 AM: 126 packages are looking for funding
11:30:53 AM: run npm fund for details
11:30:53 AM: found 0 vulnerabilities
11:30:53 AM: npm packages installed
11:30:54 AM: Successfully installed dependencies
11:30:54 AM: Starting build script
11:30:57 AM: Detected 1 framework(s)
11:30:57 AM: βviteβ at version β5.2.8β
11:30:57 AM: Section completed: initializing
11:30:58 AM: β
11:30:58 AM: Netlify Build
11:30:58 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
11:30:58 AM: β
11:30:58 AM: β― Version
11:30:58 AM: @netlify/build 29.39.1
11:30:58 AM: β
11:30:58 AM: β― Flags
11:30:58 AM: baseRelDir: true
11:30:58 AM: buildId: 6617adb23fea2600071d9671
11:30:58 AM: deployId: 6617adb23fea2600071d9673
11:30:58 AM: β
11:30:58 AM: β― Current directory
11:30:58 AM: /opt/build/repo
11:30:58 AM: β
11:30:58 AM: β― Config file
11:30:58 AM: No config file was defined: using default values.
11:30:58 AM: β
11:30:58 AM: β― Context
11:30:58 AM: production
11:30:58 AM: β
11:30:58 AM: Build command from Netlify app
11:30:58 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
11:30:58 AM: β
11:30:58 AM: $ npm run build
11:30:58 AM: > rohmilch-kaufen@0.0.0 build
11:30:58 AM: > vite build
11:30:58 AM: vite v5.2.8 building for productionβ¦
11:30:59 AM: Failed during stage βbuilding siteβ: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums)
11:30:59 AM: transformingβ¦
11:30:59 AM: β 20 modules transformed.
11:30:59 AM: x Build failed in 497ms
11:30:59 AM: error during build:
11:30:59 AM: RollupError: Could not resolve ββ¦/components/footer.jsxβ from βsrc/pages/faq.jsxβ
11:30:59 AM: file: /opt/build/repo/src/pages/faq.jsx
11:30:59 AM: at getRollupError (file:///opt/build/repo/node_modules/rollup/dist/es/shared/parseAst.js:392:41)
11:30:59 AM: at error (file:///opt/build/repo/node_modules/rollup/dist/es/shared/parseAst.js:388:42)
11:30:59 AM: at ModuleLoader.handleInvalidResolvedId (file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:18925:24)
11:30:59 AM: at file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:18885:26
11:30:59 AM: β
11:30:59 AM: βbuild.commandβ failed
11:30:59 AM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
11:30:59 AM: β
11:30:59 AM: Error message
11:30:59 AM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
11:30:59 AM: β
11:30:59 AM: Error location
11:30:59 AM: In Build command from Netlify app:
11:30:59 AM: npm run build
11:30:59 AM: β
11:30:59 AM: Resolved config
11:30:59 AM: build:
11:30:59 AM: command: npm run build
11:30:59 AM: commandOrigin: ui
11:30:59 AM: publish: /opt/build/repo/dist
11:30:59 AM: publishOrigin: ui
11:30:59 AM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:30:59 AM: Failing build: Failed to build site
11:31:00 AM: Finished processing build request in 23.088s