Site deploy error - Can't resolve markdown file

In my project, I use ‘react-markdown’ to display some markdown files on component. When I deploy on Netlify, I got this error.

PLEASE help me to understand and give a solution to this Deploy error. Thanks

Deploy log

────────────────────────────────────────────────────────────────
5:17:15 PM: 1. Build command from Netlify app
5:17:15 PM: ────────────────────────────────────────────────────────────────
5:17:15 PM: ​
5:17:15 PM: $ yarn build
5:17:15 PM: yarn run v1.22.10
5:17:15 PM: $ react-scripts build
5:17:17 PM: Creating an optimized production build…
5:17:18 PM: Failed to compile.
5:17:18 PM:
5:17:18 PM: Module not found: Error: Can’t resolve ‘…/assets/markdown/javascript/JavaScript.md’ in ‘/opt/build/repo/src/routes’
5:17:18 PM: error Command failed with exit code 1. (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
5:17:18 PM: info Visit yarn run | Yarn for documentation about this command.
5:17:18 PM: ​
5:17:18 PM: ────────────────────────────────────────────────────────────────
5:17:18 PM: “build.command” failed
5:17:18 PM: ────────────────────────────────────────────────────────────────
5:17:18 PM: ​
5:17:18 PM: Error message
5:17:18 PM: Command failed with exit code 1: yarn build (Search results for '"non-zero exit code: 1"' - Netlify Support Forums)
5:17:18 PM: ​
5:17:18 PM: Error location
5:17:18 PM: In Build command from Netlify app:
5:17:18 PM: yarn build
5:17:18 PM: ​
5:17:18 PM: Resolved config
5:17:18 PM: build:
5:17:18 PM: command: yarn build
5:17:18 PM: commandOrigin: ui
5:17:18 PM: publish: /opt/build/repo/build
5:17:18 PM: publishOrigin: ui
5:17:19 PM: Caching artifacts
5:17:19 PM: Started saving node modules
5:17:19 PM: Finished saving node modules
5:17:19 PM: Started saving build plugins
5:17:19 PM: Finished saving build plugins
5:17:19 PM: Started saving yarn cache
5:17:24 PM: Finished saving yarn cache
5:17:24 PM: Started saving pip cache
5:17:24 PM: Finished saving pip cache
5:17:24 PM: Started saving emacs cask dependencies
5:17:24 PM: Finished saving emacs cask dependencies
5:17:24 PM: Started saving maven dependencies
5:17:24 PM: Finished saving maven dependencies
5:17:24 PM: Started saving boot dependencies
5:17:24 PM: Finished saving boot dependencies
5:17:24 PM: Started saving rust rustup cache
5:17:24 PM: Finished saving rust rustup cache
5:17:24 PM: Started saving go dependencies
5:17:24 PM: Finished saving go dependencies
5:17:25 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:17:25 PM: Creating deploy upload records
5:17:26 PM: Failing build: Failed to build site
5:17:26 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:17:26 PM: Finished processing build request in 48.39328787s

Hi @trueanh

It is possible this is a case sensitivity issue

Failing that, are you able to share the repository you are deploying from?

Hey @coelmay

Thank you for this detailed explanation. I’ve just started my first ReactJS project this may be a very common mistake when deploying on Netlify.

In ReactJS tutorial videos, people have difference way to name project files and I think best practice is:
we should have lower case file names (not a mix case like Camel Rule) in project.

In my project, the problem only occurs only with Markdown file name. So following your suggestion I make markdown file name lowercase and it work well

  • Turn on case sensitive in git config command: git config core.ignorecase false
  • Lowercase all files (not recursive) command: for /f “Tokens=*” %f in (‘dir /l/b/a-d’) do (rename “%f” “%f”)

Other files like JSX, JS, CSS, Images (gif, svg…) still have a mix case file name and it’s ok.

Sorry for my bad English, once again, thank you for help and appreciate it. Have a good day :partying_face:

1 Like