I wrote my React project and can run on localhost and also I can build with yarn build
command on my computer.
I pushed my project to github ( Repo ). When I want to deploy to my project to Vercel or Netlify I'm getting error which is Cannot find file '../../components/collection-item/Collection-item' in './src/pages/collection'.
but there is no problem with path or something as I said I can run and build it my own computer. I couldn't find a solution. I changed file name and path still same.
Here is Netlify Logs:
1:24:32 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
1:24:32 PM: build-image tag: v3.4.1
1:24:32 PM: buildbot version: bca3bbf1ce7c7ca2e2192b1683becc1d98c88c5b
1:24:32 PM: Fetching cached dependencies
1:24:32 PM: Failed to fetch cache, continuing with build
1:24:32 PM: Starting to prepare the repo for build
1:24:32 PM: No cached dependencies found. Cloning fresh repo
1:24:32 PM: git clone https://github.com/OrhanOzkercin/ReactShop
1:24:33 PM: Preparing Git Reference refs/heads/Build
1:24:34 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus 'build/' in the Netlify UI
1:24:34 PM: Starting build script
1:24:34 PM: Installing dependencies
1:24:34 PM: Python version set to 2.7
1:24:35 PM: v12.18.0 is already installed.
1:24:35 PM: Now using node v12.18.0 (npm v6.14.4)
1:24:35 PM: Started restoring cached build plugins
1:24:35 PM: Finished restoring cached build plugins
1:24:36 PM: Attempting ruby version 2.7.1, read from environment
1:24:37 PM: Using ruby version 2.7.1
1:24:37 PM: Using PHP version 5.6
1:24:37 PM: 5.2 is already installed.
1:24:37 PM: Using Swift version 5.2
1:24:37 PM: Started restoring cached node modules
1:24:37 PM: Finished restoring cached node modules
1:24:37 PM: Started restoring cached yarn cache
1:24:37 PM: Finished restoring cached yarn cache
1:24:37 PM: Installing yarn at version 1.22.4
1:24:37 PM: Installing Yarn!
1:24:37 PM: > Downloading tarball...
1:24:37 PM: [1/2]: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz --> /tmp/yarn.tar.gz.fZhfENjJTT
1:24:37 PM: % Total % Received % Xferd Average Speed Time Time Time Current
1:24:37 PM: Dload Upload Total Spent Left Speed
1:24:37 PM: 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
1:24:37 PM: 100 80 100 80 0 0 249 0 --:--:-- --:--:-- --:--:-- 249
1:24:38 PM: 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
1:24:38 PM: 100 93 100 93 0 0 139 0 --:--:-- --:--:-- --:--:-- 332
1:24:38 PM: 100 630 100 630 0 0 612 0 0:00:01 0:00:01 --:--:-- 612
1:24:39 PM: 22 1215k 22 270k 0 0 194k 0 0:00:06 0:00:01 0:00:05 194k
1:24:39 PM: 100 1215k 100 1215k 0 0 840k 0 0:00:01 0:00:01 --:--:-- 17.0M
1:24:39 PM: [2/2]: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz.asc --> /tmp/yarn.tar.gz.fZhfENjJTT.asc
1:24:39 PM: 100 84 100 84 0 0 2358 0 --:--:-- --:--:-- --:--:-- 2358
1:24:39 PM: 100 97 100 97 0 0 1433 0 --:--:-- --:--:-- --:--:-- 1433
1:24:39 PM: 100 634 100 634 0 0 2905 0 --:--:-- --:--:-- --:--:-- 2905
1:24:39 PM: 100 1028 100 1028 0 0 3986 0 --:--:-- --:--:-- --:--:-- 3986
1:24:39 PM: > Verifying integrity...
1:24:39 PM: gpg: Signature made Mon 09 Mar 2020 03:52:13 PM UTC using RSA key ID 69475BAA
1:24:39 PM: gpg: Good signature from "Yarn Packaging <[email protected]>"
1:24:39 PM: gpg: WARNING: This key is not certified with a trusted signature!
1:24:39 PM: gpg: There is no indication that the signature belongs to the owner.
1:24:39 PM: Primary key fingerprint: 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310
1:24:39 PM: Subkey fingerprint: 6D98 490C 6F1A CDDD 448E 4595 4F77 6793 6947 5BAA
1:24:39 PM: > GPG signature looks good
1:24:39 PM: > Extracting to ~/.yarn...
1:24:39 PM: > Adding to $PATH...
1:24:39 PM: > Successfully installed Yarn 1.22.4! Please open another terminal where the `yarn` command will now be available.
1:24:40 PM: Installing NPM modules using Yarn version 1.22.4
1:24:40 PM: yarn install v1.22.4
1:24:40 PM: [1/4] Resolving packages...
1:24:41 PM: [2/4] Fetching packages...
1:25:03 PM: info [email protected]: The platform "linux" is incompatible with this module.
1:25:03 PM: info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
1:25:03 PM: info [email protected]: The platform "linux" is incompatible with this module.
1:25:03 PM: info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
1:25:03 PM: info [email protected]: The platform "linux" is incompatible with this module.
1:25:03 PM: info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
1:25:03 PM: [3/4] Linking dependencies...
1:25:03 PM: warning " > @testing-library/[email protected]" has unmet peer dependency "@testing-library/dom@>=5".
1:25:03 PM: warning "react-scripts > @typescript-eslint/eslint-plugin > [email protected]" 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".
1:25:03 PM: warning " > [email protected]" has unmet peer dependency "react-is@>= 16.8.0".
1:25:15 PM: [4/4] Building fresh packages...
1:25:17 PM: Done in 36.81s.
1:25:17 PM: NPM modules installed using Yarn
1:25:17 PM: Started restoring cached go cache
1:25:17 PM: Finished restoring cached go cache
1:25:17 PM: go version go1.14.4 linux/amd64
1:25:17 PM: go version go1.14.4 linux/amd64
1:25:17 PM: Installing missing commands
1:25:17 PM: Verify run directory
1:25:18 PM:
1:25:18 PM: ┌─────────────────────────────┐
1:25:18 PM: │ Netlify Build │
1:25:18 PM: └─────────────────────────────┘
1:25:19 PM:
1:25:19 PM: ❯ Version
1:25:19 PM: @netlify/build 3.1.10
1:25:19 PM:
1:25:19 PM: ❯ Flags
1:25:19 PM: deployId: 5f2e7d5a88b3fd0007415022
1:25:19 PM: mode: buildbot
1:25:19 PM: timersFile: /tmp/substage_times.txt
1:25:19 PM:
1:25:19 PM: ❯ Current directory
1:25:19 PM: /opt/build/repo
1:25:19 PM:
1:25:19 PM: ❯ Config file
1:25:19 PM: No config file was defined: using default values.
1:25:19 PM:
1:25:19 PM: ❯ Context
1:25:19 PM: production
1:25:19 PM:
1:25:19 PM: ┌───────────────────────────────────┐
1:25:19 PM: │ 1. Build command from Netlify app │
1:25:19 PM: └───────────────────────────────────┘
1:25:19 PM:
1:25:19 PM: $ yarn build
1:25:19 PM: yarn run v1.22.4
1:25:19 PM: $ react-scripts build
1:25:20 PM: Creating an optimized production build...
1:25:27 PM: Failed to compile.
1:25:27 PM:
1:25:27 PM: ./src/pages/collection/Collectionpage.jsx
1:25:27 PM: Cannot find file '../../components/collection-item/Collection-item' in './src/pages/collection'.
1:25:28 PM: error Command failed with exit code 1.
1:25:28 PM: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
1:25:28 PM:
1:25:28 PM: If the build failed with a warning about "process.env.CI = true", this is due to "create-react-app" treating warnings as errors when in CI. In order to fix this problem, please either:
1:25:28 PM: - Fix the issues highlighted by the warnings above.
1:25:28 PM: - Or modify the "scripts.build" command in your "package.json" from "react-scripts build" to "CI= react-scripts build"
1:25:28 PM: More information can be found at https://docs.netlify.com/configure-builds/troubleshooting-tips/#build-fails-on-warning-message
1:25:28 PM:
1:25:28 PM: ┌─────────────────────────────┐
1:25:28 PM: │ "build.command" failed │
1:25:28 PM: └─────────────────────────────┘
1:25:28 PM:
1:25:28 PM: Error message
1:25:28 PM: Command failed with exit code 1: yarn build
1:25:28 PM:
1:25:28 PM: Error location
1:25:28 PM: In Build command from Netlify app:
1:25:28 PM: yarn build
1:25:28 PM:
1:25:28 PM: Resolved config
1:25:28 PM: build:
1:25:28 PM: command: yarn build
1:25:28 PM: commandOrigin: ui
1:25:28 PM: publish: /opt/build/repo/build
1:25:28 PM: Caching artifacts
1:25:28 PM: Started saving node modules
1:25:28 PM: Finished saving node modules
1:25:28 PM: Started saving build plugins
1:25:28 PM: Finished saving build plugins
1:25:28 PM: Started saving yarn cache
1:25:28 PM: Finished saving yarn cache
1:25:28 PM: Started saving pip cache
1:25:28 PM: Finished saving pip cache
1:25:28 PM: Started saving emacs cask dependencies
1:25:28 PM: Finished saving emacs cask dependencies
1:25:28 PM: Started saving maven dependencies
1:25:28 PM: Finished saving maven dependencies
1:25:28 PM: Started saving boot dependencies
1:25:28 PM: Finished saving boot dependencies
1:25:28 PM: Started saving go dependencies
1:25:28 PM: Finished saving go dependencies
1:25:30 PM: Error running command: Build script returned non-zero exit code: 1
1:25:30 PM: Failing build: Failed to build site
1:25:30 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
1:25:30 PM: Finished processing build request in 58.952206659s```
Go in package.json and in scripts, replace build with this:
"build": "CI= react-scripts build",
Answer for people who has same problem.
In my case I changed some of my files name to capitalize version. The problem was Git didn't resolve this change that's why my file structure was wrong on Github. So Solution is changind this config with git.
git config core.ignorecase false
this command makes git to be aware of capitalization.
Here is another question on Stacoverflow: I change the capitalization of a directory and Git doesn't seem to pick up on it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With