Netlify deployment is failing despite all scripts running perfectly fine locally

I’m having issues with one of my sites. The build seems to be failing on an import line in one of my JS files, but running all the same commands locally, I don’t have any issues… I don’t know how to debug why Netlify is failing.

The site is built using Svelte and Sapper, and I was initially getting the following error:
‘svelte-icons/fa/FAPenFancy.svelte’ is imported by src/components/features.js, but could not be resolved – treating it as an external dependency

svelte-icons is a package that is in my package.json, so should have been installed when Netlify kicked off the deployment process.

Anyway, to try and get around this, I copied the source files for the couple of icons I was using from that package, into my src directory, and updated the import statements to point to those local versions. However, when Netlify tried to deploy this, I got the following error:
Could not resolve ‘./svelte-icons/FAPenFancy.svelte’ from src/components/features.js

I’ve run the exact same commands locally, and I don’t get any issues. I’ve even tried running netlify dev on my local, and I still have no issues…

Does Netlify not like Svelte or Rollup? Or what else could be going on here?

hi there, welcome.

can you share the following please:

  • your entire build log - or link us to a deploy
  • the netlify instance name you are working with, for example sample-site.netlify.com

Hi Perry,

I certainly can! I wasn’t sure if it was worth sharing the name of the site, as I thought this was just a place to get help from other Netlify users :).

Anyway, the instance name is calendariconsgenerator.netlify.com
.
Here are the two build logs that I mentioned:

This first one is when I had svelte-icons in my node_modules folder, and tried to import it into a JS file:

This second one is when I copied the source of svelte-icons into my src directory, and updated the import path to a relative one:

Thanks

hey @denno020 - circling back to this after the weekend, unfortunately I can’t see those logs.

Are you still having issues?

Yes, I am still having issues… Are you not a Netlify employee? Why would you ask for access to a deploy if you weren’t able to look at it? :confused:

hi there, I am indeed a Netlify employee, and I’m actually seeing those logs now.

In some cases (for example, if a person has deleted their project or their account) the logs also disappear.

I am seeing this:

4:45:29 AM: > Could not resolve './svelte-icons/FAPalette.svelte' from src/components/features.js

in the second build log - often, when we see issues like this one, it is due to a capitalization issue. Our systems are case sensitive, and sometimes the wrong case can lead to issues like this one. It gets additionally complex as GitHub doesn’t handle overwriting / changing case of files very well, but I’m not convinced that is the problem.

can you post your package.json please?

Well would you look at that, it appears that case is at play here! Looking at my commit where I simply copied the icons source from node_modules to my src folder (which is the second build log that you’re also referencing), I can see that I’ve copied the file as, for example, FaPalette, but am trying to import as FAPalette. So that sounds like it would be the issue when trying to use a local copy of the icon… It seems my local build script is a little bit too lenient. I will try this again when I get home, and double check the case of everything.
Thanks for the tip!

totes! I think this is very likely to be the issue.

As i said, GitHub doesn’t handle case changes on files super well, but if you a.) delete the file. b.) commit and push c.) recreate the file d.) commit and push case changes will persist properly.

That was it! I’ve tripple checked the case, pushed the branch, and the build has worked!

Thanks Perry

1 Like