Home
Support Forums

Cannot find file '../../ui/images/snowball.png' in './src/ui/components'

Hi community, I need your help, I’m trying to deploy an app React app created with create-react-app. but it always fails when I try run build through github.

NOTE: I try run build locally and upload manually and it works.

I would like to solve this to get project working via CI.

Thanks.

10:21:22 PM: Build ready to start
10:21:23 PM: build-image version: 09c2cdcdf242cf2f57c9ee0fcad9d298fad9ad41
10:21:23 PM: build-image tag: v3.5.0
10:21:23 PM: buildbot version: 8df8a50b1177b0b57364d20e0ea150448924cebf
10:21:23 PM: Fetching cached dependencies
10:21:23 PM: Failed to fetch cache, continuing with build
10:21:23 PM: Starting to prepare the repo for build
10:21:24 PM: No cached dependencies found. Cloning fresh repo
10:21:24 PM: git clone https://github.com/Josuejoelmm/rick-and-morty
10:21:24 PM: Preparing Git Reference refs/heads/master
10:21:26 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: β€˜build’ versus β€˜build/’ in the Netlify UI
10:21:26 PM: Starting build script
10:21:26 PM: Installing dependencies
10:21:26 PM: Python version set to 2.7
10:21:27 PM: v12.18.0 is already installed.
10:21:28 PM: Now using node v12.18.0 (npm v6.14.4)
10:21:28 PM: Started restoring cached build plugins
10:21:28 PM: Finished restoring cached build plugins
10:21:28 PM: Attempting ruby version 2.7.1, read from environment
10:21:29 PM: Using ruby version 2.7.1
10:21:30 PM: Using PHP version 5.6
10:21:30 PM: Started restoring cached node modules
10:21:30 PM: Finished restoring cached node modules
10:21:30 PM: Installing NPM modules using NPM version 6.14.4
10:22:02 PM: > node-sass@4.13.1 install /opt/build/repo/node_modules/node-sass
10:22:02 PM: > node scripts/install.js
10:22:02 PM: Downloading binary from https://github.com/sass/node-sass/releases/download/v4.13.1/linux-x64-72_binding.node
10:22:03 PM: Download complete
10:22:03 PM: Binary saved to /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
10:22:03 PM: Caching binary to /opt/buildhome/.npm/node-sass/4.13.1/linux-x64-72_binding.node
10:22:03 PM: > core-js@2.6.11 postinstall /opt/build/repo/node_modules/babel-runtime/node_modules/core-js
10:22:03 PM: > node -e β€œtry{require(’./postinstall’)}catch(e){}”
10:22:03 PM: > core-js@3.6.4 postinstall /opt/build/repo/node_modules/core-js
10:22:03 PM: > node -e β€œtry{require(’./postinstall’)}catch(e){}”
10:22:04 PM: > node-sass@4.13.1 postinstall /opt/build/repo/node_modules/node-sass
10:22:04 PM: > node scripts/build.js
10:22:04 PM: Binary found at /opt/build/repo/node_modules/node-sass/vendor/linux-x64-72/binding.node
10:22:04 PM: Testing binary
10:22:05 PM: Binary is fine
10:22:07 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/webpack-dev-server/node_modules/fsevents):
10:22:07 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {β€œos”:β€œdarwin”,β€œarch”:β€œany”} (current: {β€œos”:β€œlinux”,β€œarch”:β€œx64”})
10:22:07 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/watchpack/node_modules/fsevents):
10:22:07 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {β€œos”:β€œdarwin”,β€œarch”:β€œany”} (current: {β€œos”:β€œlinux”,β€œarch”:β€œx64”})
10:22:07 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/jest-haste-map/node_modules/fsevents):
10:22:07 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {β€œos”:β€œdarwin”,β€œarch”:β€œany”} (current: {β€œos”:β€œlinux”,β€œarch”:β€œx64”})
10:22:07 PM: npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules/fsevents):
10:22:07 PM: npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {β€œos”:β€œdarwin”,β€œarch”:β€œany”} (current: {β€œos”:β€œlinux”,β€œarch”:β€œx64”})
10:22:07 PM: added 1692 packages from 826 contributors and audited 1897 packages in 36.238s
10:22:09 PM: 48 packages are looking for funding
10:22:09 PM: run npm fund for details
10:22:09 PM: found 3799 vulnerabilities (3785 low, 7 moderate, 7 high)
10:22:09 PM: run npm audit fix to fix them, or npm audit for details
10:22:09 PM: NPM modules installed
10:22:09 PM: Started restoring cached go cache
10:22:09 PM: Finished restoring cached go cache
10:22:09 PM: go version go1.14.4 linux/amd64
10:22:09 PM: go version go1.14.4 linux/amd64
10:22:09 PM: Installing missing commands
10:22:09 PM: Verify run directory
10:22:11 PM: ​
10:22:11 PM: ────────────────────────────────────────────────────────────────
10:22:11 PM: Netlify Build
10:22:11 PM: ────────────────────────────────────────────────────────────────
10:22:11 PM: ​
10:22:11 PM: ❯ Version
10:22:11 PM: @netlify/build 5.3.3
10:22:11 PM: ​
10:22:11 PM: ❯ Flags
10:22:11 PM: deployId: 5fbdb191d41b501716013351
10:22:11 PM: mode: buildbot
10:22:11 PM: ​
10:22:11 PM: ❯ Current directory
10:22:11 PM: /opt/build/repo
10:22:11 PM: ​
10:22:11 PM: ❯ Config file
10:22:11 PM: No config file was defined: using default values.
10:22:11 PM: ​
10:22:11 PM: ❯ Context
10:22:11 PM: production
10:22:11 PM: ​
10:22:11 PM: ────────────────────────────────────────────────────────────────
10:22:11 PM: 1. Build command from Netlify app
10:22:11 PM: ────────────────────────────────────────────────────────────────
10:22:11 PM: ​
10:22:11 PM: $ npm run build
10:22:11 PM: > rick-and-morty@0.1.0 build /opt/build/repo
10:22:11 PM: > react-scripts build
10:22:12 PM: Creating an optimized production build…
10:22:14 PM: Browserslist: caniuse-lite is outdated. Please run the following command: npm update
10:22:18 PM: Failed to compile.
10:22:18 PM:
10:22:18 PM: ./src/ui/components/NotFound.jsx
10:22:18 PM: Cannot find file β€˜β€¦/…/ui/images/snowball.png’ in β€˜./src/ui/components’.
10:22:18 PM: npm ERR! code ELIFECYCLE
10:22:18 PM: npm ERR! errno 1
10:22:18 PM: npm ERR! rick-and-morty@0.1.0 build: react-scripts build
10:22:18 PM: npm ERR! Exit status 1
10:22:18 PM: npm ERR!
10:22:18 PM: npm ERR! Failed at the rick-and-morty@0.1.0 build script.
10:22:18 PM: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
10:22:18 PM: npm ERR! A complete log of this run can be found in:
10:22:18 PM: npm ERR! /opt/buildhome/.npm/_logs/2020-11-25T01_22_18_245Z-debug.log
10:22:18 PM: ​
10:22:18 PM: ────────────────────────────────────────────────────────────────
10:22:18 PM: β€œbuild.command” failed
10:22:18 PM: ────────────────────────────────────────────────────────────────
10:22:18 PM: ​
10:22:18 PM: Error message
10:22:18 PM: Command failed with exit code 1: npm run build
10:22:18 PM: ​
10:22:18 PM: Error location
10:22:18 PM: In Build command from Netlify app:
10:22:18 PM: npm run build
10:22:18 PM: ​
10:22:18 PM: Resolved config
10:22:18 PM: build:
10:22:18 PM: command: npm run build
10:22:18 PM: commandOrigin: ui
10:22:18 PM: publish: /opt/build/repo/build
10:22:18 PM: Caching artifacts
10:22:18 PM: Started saving node modules
10:22:18 PM: Finished saving node modules
10:22:18 PM: Started saving build plugins
10:22:18 PM: Finished saving build plugins
10:22:18 PM: Started saving pip cache
10:22:18 PM: Finished saving pip cache
10:22:18 PM: Started saving emacs cask dependencies
10:22:18 PM: Finished saving emacs cask dependencies
10:22:18 PM: Started saving maven dependencies
10:22:18 PM: Finished saving maven dependencies
10:22:18 PM: Started saving boot dependencies
10:22:18 PM: Finished saving boot dependencies
10:22:18 PM: Started saving go dependencies
10:22:18 PM: Finished saving go dependencies
10:22:21 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
10:22:21 PM: Failing build: Failed to build site
10:22:21 PM: Failed during stage β€˜building site’: Build script returned non-zero exit code: 2
10:22:21 PM: Finished processing build request in 57.739418923s

There’s no images folder in your repo. So, basically, if it’s working locally, it means that, the images folder is not getting uploaded or something.

Hi @hrishikesh that’s correct, I noticed that but isn’t that supposed to be the right thing to do? I mean, in my .gitignore file I have added all ext so that they are not in the repository.

.gitignore file:

dependencies

/node_modules
/.pnp
.pnp.js

testing

/coverage

production

/build

misc

.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

images

*.png
*.jpg
*.gif
*.png
*.svg
*.ico

So if it’s not in the repository, how else can Netlify access the file?

Sure, you’re right, I removed all the image exceptions from my gitignore file and voila, everything worked, thank you very much.

1 Like