It works well my localhost but cant deploy in netlify

i tried npm run build too. but still not work.
what should i do?

7:48:46 PM: Preparing Git Reference refs/heads/main
7:48:43 PM: Build ready to start
7:48:45 PM: build-image version: d2c6dbeac570350a387d832f64bc980dc964ad65 (focal)
7:48:45 PM: build-image tag: v4.8.0
7:48:45 PM: buildbot version: e552b142336b2b1222a93a4fd4cbed0019c77b46
7:48:45 PM: Fetching cached dependencies
7:48:45 PM: Failed to fetch cache, continuing with build
7:48:45 PM: Starting to prepare the repo for build
7:48:46 PM: No cached dependencies found. Cloning fresh repo
7:48:46 PM: git clone https://github.com/copperhun/coinbaseclone
7:48:47 PM: Parsing package.json dependencies
7:48:48 PM: Starting build script
7:48:48 PM: Installing dependencies
7:48:48 PM: Python version set to 2.7
7:48:49 PM: v16.14.2 is already installed.
7:48:49 PM: Now using node v16.14.2 (npm v8.5.0)
7:48:49 PM: Started restoring cached build plugins
7:48:49 PM: Finished restoring cached build plugins
7:48:49 PM: Attempting ruby version 2.7.2, read from environment
7:48:50 PM: Using ruby version 2.7.2
7:48:50 PM: Using PHP version 8.0
7:48:50 PM: Started restoring cached yarn cache
7:48:50 PM: Finished restoring cached yarn cache
7:48:51 PM: No yarn workspaces detected
7:48:51 PM: Started restoring cached node modules
7:48:51 PM: Finished restoring cached node modules
7:48:51 PM: Installing NPM modules using Yarn version 1.22.10
7:48:51 PM: yarn install v1.22.10
7:48:51 PM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
7:48:51 PM: [1/4] Resolving packages…
7:48:53 PM: [2/4] Fetching packages…
7:49:08 PM: info @next/swc-win32-x64-msvc@12.1.2: The platform β€œlinux” is incompatible with this module.
7:49:08 PM: info β€œ@next/swc-win32-x64-msvc@12.1.2” is an optional dependency and failed compatibility check. Excluding it from installation.
7:49:08 PM: info @next/swc-android-arm64@12.1.2: The platform β€œlinux” is incompatible with this module.
7:49:08 PM: info β€œ@next/swc-android-arm64@12.1.2” is an optional dependency and failed compatibility check. Excluding it from installation.
7:49:08 PM: info @next/swc-android-arm64@12.1.2: The CPU architecture β€œx64” is incompatible with this module.
7:49:08 PM: info @next/swc-darwin-x64@12.1.2: The platform β€œlinux” is incompatible with this module.
7:49:08 PM: info β€œ@next/swc-darwin-x64@12.1.2” is an optional dependency and failed compatibility check. Excluding it from installation.
7:49:08 PM: info @next/swc-darwin-arm64@12.1.2: The platform β€œlinux” is incompatible with this module.
7:49:08 PM: info β€œ@next/swc-darwin-arm64@12.1.2” is an optional dependency and failed compatibility check. Excluding it from installation.
7:49:08 PM: info @next/swc-darwin-arm64@12.1.2: The CPU architecture β€œx64” is incompatible with this module.
7:49:08 PM: info @next/swc-android-arm-eabi@12.1.2: The platform β€œlinux” is incompatible with this module.
7:49:08 PM: info β€œ@next/swc-android-arm-eabi@12.1.2” is an optional dependency and failed compatibility check. Excluding it from installation.
7:49:08 PM: info @next/swc-android-arm-eabi@12.1.2: The CPU architecture β€œx64” is incompatible with this module.
7:49:08 PM: info @next/swc-linux-arm64-gnu@12.1.2: The CPU architecture β€œx64” is incompatible with this module.
7:49:08 PM: info β€œ@next/swc-linux-arm64-gnu@12.1.2” is an optional dependency and failed compatibility check. Excluding it from installation.
7:49:08 PM: info @next/swc-linux-arm-gnueabihf@12.1.2: The CPU architecture β€œx64” is incompatible with this module.
7:49:08 PM: info β€œ@next/swc-linux-arm-gnueabihf@12.1.2” is an optional dependency and failed compatibility check. Excluding it from installation.
7:49:08 PM: info @next/swc-linux-arm64-musl@12.1.2: The CPU architecture β€œx64” is incompatible with this module.
7:49:08 PM: info β€œ@next/swc-linux-arm64-musl@12.1.2” is an optional dependency and failed compatibility check. Excluding it from installation.
7:49:08 PM: info @next/swc-win32-arm64-msvc@12.1.2: The platform β€œlinux” is incompatible with this module.
7:49:08 PM: info β€œ@next/swc-win32-arm64-msvc@12.1.2” is an optional dependency and failed compatibility check. Excluding it from installation.
7:49:08 PM: info @next/swc-win32-arm64-msvc@12.1.2: The CPU architecture β€œx64” is incompatible with this module.
7:49:08 PM: info @next/swc-win32-ia32-msvc@12.1.2: The platform β€œlinux” is incompatible with this module.
7:49:08 PM: info β€œ@next/swc-win32-ia32-msvc@12.1.2” is an optional dependency and failed compatibility check. Excluding it from installation.
7:49:08 PM: info @next/swc-win32-ia32-msvc@12.1.2: The CPU architecture β€œx64” is incompatible with this module.
7:49:08 PM: info fsevents@2.3.2: The platform β€œlinux” is incompatible with this module.
7:49:08 PM: info β€œfsevents@2.3.2” is an optional dependency and failed compatibility check. Excluding it from installation.
7:49:08 PM: [3/4] Linking dependencies…
7:49:08 PM: warning β€œ@3rdweb/hooks > @web3-react/walletlink-connector > walletlink > eth-block-tracker > @babel/plugin-transform-runtime@7.17.0” has unmet peer dependency β€œ@babel/core@^7.0.0-0”.
7:49:08 PM: warning β€œ@3rdweb/hooks > @web3-react/walletlink-connector > walletlink > eth-block-tracker > @babel/plugin-transform-runtime > babel-plugin-polyfill-corejs2@0.3.1” has unmet peer dependency β€œ@babel/core@^7.0.0-0”.
7:49:08 PM: warning β€œ@3rdweb/hooks > @web3-react/walletlink-connector > walletlink > eth-block-tracker > @babel/plugin-transform-runtime > babel-plugin-polyfill-corejs3@0.5.2” has unmet peer dependency β€œ@babel/core@^7.0.0-0”.
7:49:08 PM: warning β€œ@3rdweb/hooks > @web3-react/walletlink-connector > walletlink > eth-block-tracker > @babel/plugin-transform-runtime > babel-plugin-polyfill-regenerator@0.3.1” has unmet peer dependency β€œ@babel/core@^7.0.0-0”.
7:49:08 PM: warning β€œ@3rdweb/hooks > @web3-react/walletlink-connector > walletlink > eth-block-tracker > @babel/plugin-transform-runtime > babel-plugin-polyfill-corejs2 > @babel/helper-define-polyfill-provider@0.3.1” has unmet peer dependency β€œ@babel/core@^7.4.0-0”.
7:49:08 PM: warning β€œ@3rdweb/react > @chakra-ui/icons@1.1.7” has unmet peer dependency β€œ@chakra-ui/system@>=1.0.0”.
7:49:08 PM: warning β€œ@3rdweb/react > @chakra-ui/icons > @chakra-ui/icon@2.0.5” has unmet peer dependency β€œ@chakra-ui/system@>=1.0.0”.
7:49:08 PM: warning β€œ@3rdweb/react > @emotion/react > @emotion/babel-plugin@11.7.2” has unmet peer dependency β€œ@babel/core@^7.0.0”.
7:49:08 PM: warning β€œ@3rdweb/react > @emotion/react > @emotion/babel-plugin > @babel/plugin-syntax-jsx@7.16.7” has unmet peer dependency β€œ@babel/core@^7.0.0-0”.
7:49:08 PM: warning " > @3rdweb/sdk@1.42.0" has unmet peer dependency β€œethers@^5.4.6”.
7:49:08 PM: warning " > styled-components@5.3.5" has unmet peer dependency β€œreact-is@>= 16.8.0”.
7:49:08 PM: warning β€œeslint-config-next > @typescript-eslint/parser > @typescript-eslint/typescript-estree > tsutils@3.21.0” has unmet peer dependency β€œtypescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta”.
7:49:14 PM: [4/4] Building fresh packages…
7:49:17 PM: success Saved lockfile.
7:49:17 PM: Done in 26.05s.
7:49:17 PM: NPM modules installed using Yarn
7:49:18 PM: Started restoring cached go cache
7:49:18 PM: Finished restoring cached go cache
7:49:18 PM: go version go1.16.5 linux/amd64
7:49:18 PM: go version go1.16.5 linux/amd64
7:49:18 PM: Installing missing commands
7:49:18 PM: Verify run directory
7:49:19 PM: ​
7:49:19 PM: ────────────────────────────────────────────────────────────────
7:49:19 PM: Netlify Build
7:49:19 PM: ────────────────────────────────────────────────────────────────
7:49:19 PM: ​
7:49:19 PM: ❯ Version
7:49:19 PM: @netlify/build 26.5.2
7:49:19 PM: ​
7:49:19 PM: ❯ Flags
7:49:19 PM: baseRelDir: true
7:49:19 PM: buildId: 624c1e8bbe58412138cd3921
7:49:19 PM: deployId: 624c1e8bbe58412138cd3923
7:49:19 PM: ​
7:49:19 PM: ❯ Current directory
7:49:19 PM: /opt/build/repo
7:49:19 PM: ​
7:49:19 PM: ❯ Config file
7:49:19 PM: No config file was defined: using default values.
7:49:19 PM: ​
7:49:19 PM: ❯ Context
7:49:19 PM: production
7:49:19 PM: ​
7:49:19 PM: ❯ Loading plugins
7:49:19 PM: - @netlify/plugin-nextjs@4.3.1 from Netlify app and package.json
7:49:20 PM: ​
7:49:20 PM: ────────────────────────────────────────────────────────────────
7:49:20 PM: 1. @netlify/plugin-nextjs (onPreBuild event)
7:49:20 PM: ────────────────────────────────────────────────────────────────
7:49:20 PM: ​
7:49:20 PM: No Next.js cache to restore.
7:49:20 PM: Netlify configuration property β€œbuild.environment.NEXT_PRIVATE_TARGET” value changed.
7:49:20 PM: ​
7:49:20 PM: (@netlify/plugin-nextjs onPreBuild completed in 24ms)
7:49:20 PM: ​
7:49:20 PM: ────────────────────────────────────────────────────────────────
7:49:20 PM: 2. Build command from Netlify app
7:49:20 PM: ────────────────────────────────────────────────────────────────
7:49:20 PM: ​
7:49:20 PM: $ yarn build
7:49:20 PM: yarn run v1.22.10
7:49:20 PM: $ next build
7:49:21 PM: info - Loaded env from /opt/build/repo/.env
7:49:21 PM: warn - No build cache found. Please configure build caching for faster rebuilds. Read more: no-cache | Next.js
7:49:21 PM: info - Checking validity of types…
7:49:21 PM: info - Creating an optimized production build…
7:50:09 PM: Failed to compile.
7:50:09 PM:
7:50:09 PM: ./components/modal/coinSelector.js
7:50:09 PM: Module not found: Can’t resolve β€˜./CoinItem’ in β€˜/opt/build/repo/components/modal’
7:50:09 PM: Import trace for requested module:
7:50:09 PM: ./components/modal/TransferModal.js
7:50:09 PM: ./components/Header.js
7:50:09 PM: ./pages/Dashboard.js
7:50:09 PM: > Build failed because of webpack errors
7:50:09 PM: error Command failed with exit code 1. (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
7:50:09 PM: info Visit yarn run | Yarn for documentation about this command.
7:50:09 PM: ​
7:50:09 PM: ────────────────────────────────────────────────────────────────
7:50:09 PM: β€œbuild.command” failed
7:50:09 PM: ────────────────────────────────────────────────────────────────
7:50:09 PM: ​
7:50:09 PM: Error message
7:50:09 PM: Command failed with exit code 1: yarn build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
7:50:09 PM: ​
7:50:09 PM: Error location
7:50:09 PM: In Build command from Netlify app:
7:50:09 PM: yarn build
7:50:09 PM: ​
7:50:09 PM: Resolved config
7:50:09 PM: build:
7:50:09 PM: command: yarn build
7:50:09 PM: commandOrigin: ui
7:50:09 PM: environment:
7:50:09 PM: - NEXT_PRIVATE_TARGET
7:50:09 PM: publish: /opt/build/repo/.next
7:50:09 PM: publishOrigin: ui
7:50:09 PM: plugins:
7:50:09 PM: - inputs: {}
7:50:09 PM: origin: ui
7:50:09 PM: package: β€˜@netlify/plugin-nextjs’
7:50:10 PM: Caching artifacts
7:50:10 PM: Started saving node modules
7:50:10 PM: Finished saving node modules
7:50:10 PM: Started saving build plugins
7:50:10 PM: Finished saving build plugins
7:50:10 PM: Started saving yarn cache
7:50:14 PM: Finished saving yarn cache
7:50:14 PM: Started saving pip cache
7:50:14 PM: Finished saving pip cache
7:50:14 PM: Started saving emacs cask dependencies
7:50:14 PM: Finished saving emacs cask dependencies
7:50:14 PM: Started saving maven dependencies
7:50:14 PM: Finished saving maven dependencies
7:50:14 PM: Started saving boot dependencies
7:50:14 PM: Finished saving boot dependencies
7:50:14 PM: Started saving rust rustup cache
7:50:14 PM: Finished saving rust rustup cache
7:50:14 PM: Started saving go dependencies
7:50:14 PM: Finished saving go dependencies
7:50:16 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
7:50:16 PM: Creating deploy upload records
7:50:16 PM: Failing build: Failed to build site
7:50:16 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)
7:50:16 PM: Finished processing build request in 1m30.931510161s

Hey @copperhun

As the repository is private I can only makes guesses, but I suggest this is possibly a case-sensitivity issue.

1 Like