# Gatsby website Build works in local but fails on Netlify because of video import

**URL:** <https://answers.netlify.com/t/gatsby-website-build-works-in-local-but-fails-on-netlify-because-of-video-import/88017>\
**Category:** Support\
**Tags:** building, gatsby\
**Created:** [March 19, 2023, 11:03am UTC](https://answers.netlify.com/t/gatsby-website-build-works-in-local-but-fails-on-netlify-because-of-video-import/88017 "2023-03-19T11:03:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![wow\_studio](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@wow\_studio](https://answers.netlify.com/u/wow_studio)\
**Post date:** [March 19, 2023, 11:03am UTC](https://answers.netlify.com/t/gatsby-website-build-works-in-local-but-fails-on-netlify-because-of-video-import/88017/1 "2023-03-19T11:03:47Z")

</div>

using gatsby 5  
netlify deployment message (I’ve shortened the message)

4:01:03 PM: $ gatsby build  
4:01:19 PM: success write out requires - 0.006s  
4:01:24 PM: failed Building production JavaScript and CSS bundles - 4.848s  
4:01:24 PM: error Generating JavaScript bundles failed  
4:01:24 PM: Can’t resolve ‘./…/video/wow-studio-hd.mp4’ in ‘/opt/build/repo/src/pages’  
4:01:24 PM: If you’re trying to use a package make sure that ‘./…/video/wow-studio-hd.mp4’ is installed. If you’re trying to use a local file make sure that the path is correct.  
4:01:24 PM: “build.command” failed ────────────────────────────────────────────────────────────────  
4:01:24 PM: Error message  
4:01:24 PM: Command failed with exit code 1: gatsby build ([Search results for '"non-zero exit code: 1"' - Netlify Support Forums](https://ntl.fyi/exit-code-1))  
4:01:24 PM: Error location  
4:01:24 PM: In Build command from Netlify app:  
4:01:24 PM: gatsby build  
4:01:24 PM: ​  
4:01:24 PM: Resolved config  
4:01:24 PM: build:  
4:01:24 PM: command: gatsby build  
4:01:24 PM: commandOrigin: ui  
4:01:24 PM: publish: /opt/build/repo/public  
4:01:24 PM: publishOrigin: ui  
4:01:25 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](https://ntl.fyi/exit-code-2))  
4:01:24 PM: plugins:  
4:01:24 PM: - inputs: {}  
4:01:24 PM: origin: ui  
4:01:24 PM: package: ‘@netlify/plugin-gatsby’  
4:01:24 PM: redirects:  
4:01:25 PM: - from: /api/\* status: 200 to: /.netlify/functions/\_\_apiCaching artifacts  
4:01:25 PM: Started saving node modules  
4:01:25 PM: Finished saving node modules  
4:01:25 PM: Build failed due to a user error: Build script returned non-zero exit code: 2  
4:01:25 PM: Failing build: Failed to build site  
4:01:25 PM: Finished processing build request in 41.29s`

**the page where I am importing the video:**

```auto
import React from "react"
import type { PageProps } from "gatsby"
import videoHDmp4 from "./../video/wow-studio-hd.mp4";
import Layout from "../components/Layout"

const IndexPage: React.FC<PageProps> = ({data}: any) => {

    return (
        <Layout>
            <video poster="/bg-texture-min.webp" controls={false} preload="auto" muted={true} autoPlay={true} loop={true} style={{width: "100%", height: "100%"}}>
                <source src={videoHDmp4} type="video/mp4"/>
                <source src="/wow-studio-hd.ogg" type="video/ogg"/>
            </video>
        </Layout>
    )
}

export default IndexPage;

folder structure:
>public
>src
   >pages
         >index.tsx
   >video
       myVideo
>static
    >video
        >myVideo

```

type or paste code here

```auto
this is my first question so any feedback is appreciated
```

---

<div class="post-metadata">

**Author:** ![hrishikesh](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/hrishikesh/32/74607_2.png) [@hrishikesh](https://answers.netlify.com/u/hrishikesh)\
**Post date:** [March 19, 2023, 1:07pm UTC](https://answers.netlify.com/t/gatsby-website-build-works-in-local-but-fails-on-netlify-because-of-video-import/88017/2 "2023-03-19T13:07:10Z")

</div>

Try:

> [@\[Support Guide\] Netlify app builds locally but fails on deploy (case sensitivity)](https://answers.netlify.com/t/support-guide-netlify-app-builds-locally-but-fails-on-deploy-case-sensitivity/10754):
>
> Last updated by Netlify Support: July 2025 Are you struggling to understand why your project runs locally but errors out with missing files or logs that point toward issues with case when you try and build on Netlify? You are not alone. Often, case (as in: UPPERCASE or lowercase letters in filenames or paths) can cause problems. Here is a guide to understanding how case sensitivity issues present themselves, why they arise, and how you can fix them! 1. Errors you might see Case sensitivity iss…

---

<div class="post-metadata">

**Author:** ![wow\_studio](https://avatars.discourse-cdn.com/v4/letter/w/ac8455/32.png) [@wow\_studio](https://answers.netlify.com/u/wow_studio)\
**Post date:** [March 31, 2023, 8:07pm UTC](https://answers.netlify.com/t/gatsby-website-build-works-in-local-but-fails-on-netlify-because-of-video-import/88017/3 "2023-03-31T20:07:11Z")

</div>

thank you for the reply

I found the issue .mp4 was in my .gitignore file therefore netlify was not able to locate the video file

---

<div class="post-metadata">

**Author:** ![SamO](https://sea1.discourse-cdn.com/netlify/user_avatar/answers.netlify.com/samo/32/41847_2.png) [@SamO](https://answers.netlify.com/u/SamO)\
**Post date:** [April 3, 2023, 2:51pm UTC](https://answers.netlify.com/t/gatsby-website-build-works-in-local-but-fails-on-netlify-because-of-video-import/88017/4 "2023-04-03T14:51:30Z")

</div>

that’s awesome thanks for sharing your solution!
