Yato
March 20, 2023, 10:22am
1
I try to deploy my site using vite, react, tailwind css, but it failed and here is the log
5:11:53 PM: build-image version: 2eaac833881accc211f920f6c5a9f4121fdb15ab (focal)
5:11:53 PM: buildbot version: 2eaac833881accc211f920f6c5a9f4121fdb15ab
5:11:53 PM: Fetching cached dependencies
5:11:53 PM: Starting to download cache of 128.6MB
5:11:54 PM: Finished downloading cache in 843ms
5:11:54 PM: Starting to extract cache
5:11:55 PM: Finished extracting cache in 1.403s
5:11:55 PM: Finished fetching cache in 2.301s
5:11:55 PM: Starting to prepare the repo for build
5:11:56 PM: Preparing Git Reference refs/heads/main
5:11:56 PM: Parsing package.json dependencies
5:11:57 PM: Starting build script
5:11:58 PM: Installing dependencies
5:11:58 PM: Python version set to 2.7
5:11:58 PM: Started restoring cached Node.js version
5:11:59 PM: Finished restoring cached Node.js version
5:11:59 PM: v16.19.1 is already installed.
5:12:00 PM: Now using node v16.19.1 (npm v8.19.3)
5:12:00 PM: Enabling Node.js Corepack
5:12:00 PM: Started restoring cached build plugins
5:12:00 PM: Finished restoring cached build plugins
5:12:00 PM: Attempting Ruby version 2.7.2, read from environment
5:12:01 PM: Using Ruby version 2.7.2
5:12:01 PM: Using PHP version 8.0
5:12:01 PM: Started restoring cached corepack dependencies
5:12:01 PM: Finished restoring cached corepack dependencies
5:12:01 PM: No npm workspaces detected
5:12:01 PM: Started restoring cached node modules
5:12:01 PM: Finished restoring cached node modules
5:12:01 PM: Installing npm packages using npm version 8.19.3
5:12:06 PM: added 4 packages, removed 12 packages, changed 19 packages, and audited 202 packages in 4s
5:12:06 PM: 37 packages are looking for funding
5:12:06 PM: run npm fund
for details
5:12:06 PM: found 0 vulnerabilities
5:12:06 PM: npm packages installed
5:12:06 PM: Started restoring cached go cache
5:12:06 PM: Finished restoring cached go cache
5:12:06 PM: go version go1.19.7 linux/amd64
5:12:06 PM: Detected 1 framework(s)
5:12:06 PM: βviteβ at version β4.2.0β
5:12:06 PM: Section completed: initializing
5:12:08 PM: β
5:12:08 PM: Netlify Build
5:12:08 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
5:12:08 PM: β
5:12:08 PM: β― Version
5:12:08 PM: @netlify /build 29.6.8
5:12:08 PM: β
5:12:08 PM: β― Flags
5:12:08 PM: baseRelDir: true
5:12:08 PM: buildId: 64183166413ac3000812ce08
5:12:08 PM: deployId: 64183166413ac3000812ce0a
5:12:08 PM: β
5:12:08 PM: β― Current directory
5:12:08 PM: /opt/build/repo
5:12:08 PM: β
5:12:08 PM: β― Config file
5:12:08 PM: No config file was defined: using default values.
5:12:08 PM: β
5:12:08 PM: β― Context
5:12:08 PM: production
5:12:08 PM: β
5:12:08 PM: 1. Build command from Netlify app
5:12:08 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
5:12:08 PM: β
5:12:08 PM: $ npm run build
5:12:08 PM: > justdoit-planner@0.0.0 build
5:12:08 PM: > vite build
5:12:09 PM: vite v4.2.0 building for productionβ¦
5:12:09 PM: transformingβ¦
5:12:09 PM: β 21 modules transformed.
5:12:09 PM: β built in 533ms
5:12:09 PM: [vite]: Rollup failed to resolve import β/src/pages/homepage/Homepage.jsxβ from β/opt/build/repo/src/App.jsxβ.
5:12:09 PM: This is most likely unintended because it can break your application at runtime.
5:12:09 PM: If you do want to externalize this module explicitly add it to
5:12:09 PM: build.rollupOptions.external
5:12:09 PM: error during build:
5:12:09 PM: Error: [vite]: Rollup failed to resolve import β/src/pages/homepage/Homepage.jsxβ from β/opt/build/repo/src/App.jsxβ.
5:12:09 PM: This is most likely unintended because it can break your application at runtime.
5:12:09 PM: If you do want to externalize this module explicitly add it to
5:12:09 PM: build.rollupOptions.external
5:12:09 PM: at onRollupWarning (file:///opt/build/repo/node_modules/vite/dist/node/chunks/dep-c167897e.js:46353:19)
5:12:10 PM: Failed during stage βbuilding siteβ: Build script returned non-zero exit code: 2 (Search results for '"non-zero exit code: 2"' - Netlify Support Forums )
5:12:09 PM: at onwarn (file:///opt/build/repo/node_modules/vite/dist/node/chunks/dep-c167897e.js:46123:13)
5:12:09 PM: at Object.onwarn (file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:25103:13)
5:12:09 PM: at ModuleLoader.handleInvalidResolvedId (file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:23778:26)
5:12:09 PM: at file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:23738:26
5:12:09 PM: β
5:12:09 PM: βbuild.commandβ failed
5:12:09 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
5:12:09 PM: β
5:12:09 PM: Error message
5:12:09 PM: Command failed with exit code 1: npm run build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums )
5:12:09 PM: β
5:12:09 PM: Error location
5:12:09 PM: In Build command from Netlify app:
5:12:09 PM: npm run build
5:12:09 PM: β
5:12:09 PM: Resolved config
5:12:09 PM: build:
5:12:09 PM: command: npm run build
5:12:09 PM: commandOrigin: ui
5:12:09 PM: environment:
5:12:09 PM: - VITE_apiKey
5:12:09 PM: - VITE_appId
5:12:09 PM: - VITE_authDomain
5:12:09 PM: - VITE_measurementId
5:12:09 PM: - VITE_messagingSenderId
5:12:09 PM: - VITE_projectId
5:12:09 PM: publish: /opt/build/repo/dist
5:12:09 PM: publishOrigin: ui
5:12:09 PM: Caching artifacts
5:12:09 PM: Started saving node modules
5:12:09 PM: Finished saving node modules
5:12:09 PM: Started saving build plugins
5:12:09 PM: Finished saving build plugins
5:12:09 PM: Started saving corepack cache
5:12:09 PM: Finished saving corepack cache
5:12:09 PM: Started saving pip cache
5:12:10 PM: Finished saving pip cache
5:12:10 PM: Started saving emacs cask dependencies
5:12:10 PM: Finished saving emacs cask dependencies
5:12:10 PM: Started saving maven dependencies
5:12:10 PM: Finished saving maven dependencies
5:12:10 PM: Started saving boot dependencies
5:12:10 PM: Finished saving boot dependencies
5:12:10 PM: Started saving rust rustup cache
5:12:10 PM: Finished saving rust rustup cache
5:12:10 PM: Started saving go dependencies
5:12:10 PM: Finished saving go dependencies
5:12:10 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:12:10 PM: Failing build: Failed to build site
5:12:10 PM: Finished processing build request in 16.828s
If anyone of u need to see the source code, itβs an open source project here
https://github.com/SeakMengs/JustDoIt-Planner
The file is lowercase in name homepage.jsx
rather than Homepage.jsx
.
The Netlify build system is case sensitive . So either change the name of the file to match the import statement or change the import statement to match the filename.
import { HomePage } from '/src/pages/homepage/homepage.jsx'
Yato
March 20, 2023, 11:14am
3
Hi, thank for your reply. I change the name and for now I have a file name called βlogout.jsxβ and the import look like this
import { Logout } from β/src/service/logout.jsxβ
here is the log again
6:11:54 PM: build-image version: 782b5df339f214fc7c855168f91b0835ad93e526 (focal)
6:11:54 PM: buildbot version: 782b5df339f214fc7c855168f91b0835ad93e526
6:11:54 PM: Fetching cached dependencies
6:11:54 PM: Starting to download cache of 128.6MB
6:11:54 PM: Finished downloading cache in 449ms
6:11:54 PM: Starting to extract cache
6:11:56 PM: Finished extracting cache in 1.332s
6:11:56 PM: Finished fetching cache in 1.819s
6:11:56 PM: Starting to prepare the repo for build
6:11:56 PM: Preparing Git Reference refs/heads/main
6:11:56 PM: Parsing package.json dependencies
6:11:58 PM: Starting build script
6:11:58 PM: Installing dependencies
6:11:58 PM: Python version set to 2.7
6:11:58 PM: Started restoring cached Node.js version
6:12:00 PM: Finished restoring cached Node.js version
6:12:00 PM: v16.19.1 is already installed.
6:12:00 PM: Now using node v16.19.1 (npm v8.19.3)
6:12:00 PM: Enabling Node.js Corepack
6:12:01 PM: Started restoring cached build plugins
6:12:01 PM: Finished restoring cached build plugins
6:12:01 PM: Attempting Ruby version 2.7.2, read from environment
6:12:01 PM: Using Ruby version 2.7.2
6:12:01 PM: Using PHP version 8.0
6:12:01 PM: Started restoring cached corepack dependencies
6:12:01 PM: Finished restoring cached corepack dependencies
6:12:01 PM: No npm workspaces detected
6:12:01 PM: Started restoring cached node modules
6:12:01 PM: Finished restoring cached node modules
6:12:02 PM: Installing npm packages using npm version 8.19.3
6:12:06 PM: added 4 packages, removed 12 packages, changed 19 packages, and audited 202 packages in 4s
6:12:06 PM: 37 packages are looking for funding
6:12:06 PM: run `npm fund` for details
6:12:06 PM: found 0 vulnerabilities
6:12:06 PM: npm packages installed
6:12:06 PM: Started restoring cached go cache
6:12:06 PM: Finished restoring cached go cache
6:12:06 PM: go version go1.19.7 linux/amd64
6:12:07 PM: Detected 1 framework(s)
6:12:07 PM: "vite" at version "4.2.0"
6:12:07 PM: Section completed: initializing
6:12:08 PM: β
6:12:08 PM: Netlify Build
6:12:08 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
6:12:08 PM: β
6:12:08 PM: β― Version
6:12:08 PM: @netlify/build 29.7.0
6:12:08 PM: β
6:12:08 PM: β― Flags
6:12:08 PM: baseRelDir: true
6:12:08 PM: buildId: 64183f76246d3700080aa7ea
6:12:08 PM: deployId: 64183f76246d3700080aa7ec
6:12:08 PM: β
6:12:08 PM: β― Current directory
6:12:08 PM: /opt/build/repo
6:12:08 PM: β
6:12:08 PM: β― Config file
6:12:08 PM: No config file was defined: using default values.
6:12:08 PM: β
6:12:08 PM: β― Context
6:12:08 PM: production
6:12:08 PM: β
6:12:08 PM: 1. Build command from Netlify app
6:12:08 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
6:12:08 PM: β
6:12:08 PM: $ npm run build
6:12:09 PM: > justdoit-planner@0.0.0 build
6:12:09 PM: > vite build
6:12:09 PM: vite v4.2.0 building for production...
6:12:09 PM: transforming...
6:12:10 PM: β 50 modules transformed.
6:12:10 PM: β built in 958ms
6:12:10 PM: [vite]: Rollup failed to resolve import "/src/service/logout.jsx" from "/opt/build/repo/src/pages/homepage/components/homeNavbar.jsx".
6:12:10 PM: This is most likely unintended because it can break your application at runtime.
6:12:10 PM: If you do want to externalize this module explicitly add it to
6:12:10 PM: `build.rollupOptions.external`
6:12:10 PM: error during build:
6:12:10 PM: Error: [vite]: Rollup failed to resolve import "/src/service/logout.jsx" from "/opt/build/repo/src/pages/homepage/components/homeNavbar.jsx".
6:12:10 PM: This is most likely unintended because it can break your application at runtime.
6:12:10 PM: If you do want to externalize this module explicitly add it to
6:12:10 PM: `build.rollupOptions.external`
6:12:10 PM: at onRollupWarning (file:///opt/build/repo/node_modules/vite/dist/node/chunks/dep-c167897e.js:46353:19)
6:12:10 PM: at onwarn (file:///opt/build/repo/node_modules/vite/dist/node/chunks/dep-c167897e.js:46123:13)
6:12:10 PM: at Object.onwarn (file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:25103:13)
6:12:10 PM: at ModuleLoader.handleInvalidResolvedId (file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:23778:26)
6:12:10 PM: at file:///opt/build/repo/node_modules/rollup/dist/es/shared/node-entry.js:23738:26
6:12:10 PM: β
6:12:10 PM: "build.command" failed
6:12:10 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
6:12:10 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
6:12:10 PM: β
6:12:10 PM: Error message
6:12:10 PM: Command failed with exit code 1: npm run build (https://ntl.fyi/exit-code-1)
6:12:10 PM: β
6:12:10 PM: Error location
6:12:10 PM: In Build command from Netlify app:
6:12:10 PM: npm run build
6:12:10 PM: β
6:12:10 PM: Resolved config
6:12:10 PM: build:
6:12:10 PM: command: npm run build
6:12:10 PM: commandOrigin: ui
6:12:10 PM: environment:
6:12:10 PM: - VITE_apiKey
6:12:10 PM: - VITE_appId
6:12:10 PM: - VITE_authDomain
6:12:10 PM: - VITE_measurementId
6:12:10 PM: - VITE_messagingSenderId
6:12:10 PM: - VITE_projectId
6:12:10 PM: publish: /opt/build/repo/dist
6:12:10 PM: publishOrigin: ui
6:12:10 PM: Caching artifacts
6:12:10 PM: Started saving node modules
6:12:10 PM: Finished saving node modules
6:12:10 PM: Started saving build plugins
6:12:10 PM: Finished saving build plugins
6:12:10 PM: Started saving corepack cache
6:12:10 PM: Finished saving corepack cache
6:12:10 PM: Started saving pip cache
6:12:10 PM: Finished saving pip cache
6:12:10 PM: Started saving emacs cask dependencies
6:12:10 PM: Finished saving emacs cask dependencies
6:12:10 PM: Started saving maven dependencies
6:12:10 PM: Finished saving maven dependencies
6:12:10 PM: Started saving boot dependencies
6:12:10 PM: Finished saving boot dependencies
6:12:10 PM: Started saving rust rustup cache
6:12:10 PM: Finished saving rust rustup cache
6:12:10 PM: Started saving go dependencies
6:12:10 PM: Finished saving go dependencies
6:12:10 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:12:10 PM: Failing build: Failed to build site
6:12:10 PM: Finished processing build request in 16.789s
Yato
March 20, 2023, 11:19am
4
So it seem like file and folder name are the problem.
I found the solution by changing folder name from
βappβ to βapplicationβ and βserviceβ to βservicesβ
1 Like
SamO
March 20, 2023, 2:49pm
5
Hi @Yato ahh what a nice catch. Glad you were able to find your solution. Thanks for coming back to the community and sharing this.
Did you mean in the root directory?