The build works locally and I’ve set my netlify.toml file so Netlify uses the same node version in netlify as it does on local.
My package.json file looks like the below.
The image I’m using is just a PNG, and the Gatsby config settings are definitely pointing to the correct the correct file, or it would fail on my local to, and Ive checked to make sure the image is actually in the repo, which it is.
Thanks for reaching out. Can you please share your link to your netlify site as well as your most recent deploy log? This will help us look into this further.
Deleted the lock file, and cleared cache on both local and netlify.
Local still builds without issues, but in netlify I’m now getting a dependency conflict error. log below. I actually updated the packages to try and fix this issue, which is frustrating.
8:16:45 AM: Build ready to start
8:17:08 AM: build-image version: 0e2f4c52031ab562db66aec633308326e3b108d0 (focal)
8:17:08 AM: build-image tag: focal
8:17:08 AM: buildbot version: 0d1cf41e4e345a224c39ab2a783aa4af5c76f6e8
8:17:08 AM: Building without cache
8:17:08 AM: Starting to prepare the repo for build
8:17:08 AM: No cached dependencies found. Cloning fresh repo
8:17:08 AM: git clone https://github.com/cdennington/paul-gawman
8:17:09 AM: Preparing Git Reference refs/heads/master
8:17:10 AM: Parsing package.json dependencies
8:17:11 AM: Different functions path detected, going to use the one specified in the Netlify configuration file: 'functions' versus './functions' in the Netlify UI
8:17:11 AM: Starting build script
8:17:11 AM: Installing dependencies
8:17:11 AM: Python version set to 2.7
8:17:12 AM: Downloading and installing node v16.15.0...
8:17:12 AM: Downloading https://nodejs.org/dist/v16.15.0/node-v16.15.0-linux-x64.tar.xz...
8:17:13 AM: Computing checksum with sha256sum
8:17:13 AM: Checksums matched!
8:17:15 AM: Now using node v16.15.0 (npm v8.5.5)
8:17:15 AM: Started restoring cached build plugins
8:17:15 AM: Finished restoring cached build plugins
8:17:15 AM: Attempting ruby version 2.7.2, read from environment
8:17:16 AM: Using ruby version 2.7.2
8:17:17 AM: Using PHP version 8.0
8:17:17 AM: No npm workspaces detected
8:17:17 AM: Started restoring cached node modules
8:17:17 AM: Finished restoring cached node modules
8:17:17 AM: Installing NPM modules using NPM version 8.5.5
8:17:21 AM: npm ERR! code ERESOLVE
8:17:21 AM: npm ERR! ERESOLVE unable to resolve dependency tree
8:17:21 AM: npm ERR!
8:17:21 AM: Creating deploy upload records
8:17:21 AM: npm ERR! While resolving: paul-gawman@1.1.3
8:17:21 AM: npm ERR! Found: react@18.2.0
8:17:21 AM: npm ERR! node_modules/react
8:17:21 AM: npm ERR! react@"18.2.0" from the root project
8:17:21 AM: npm ERR! peer react@"^16.9.0 || ^17.0.0 || ^18.0.0" from gatsby-plugin-netlify-cms@6.18.0
8:17:21 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1
8:17:21 AM: npm ERR! node_modules/gatsby-plugin-netlify-cms
8:17:21 AM: npm ERR! gatsby-plugin-netlify-cms@"6.18.0" from the root project
8:17:21 AM: npm ERR! 2 more (gatsby, react-dom)
8:17:21 AM: npm ERR!
8:17:21 AM: npm ERR! Could not resolve dependency:
8:17:21 AM: npm ERR! peer react@"^16.8.4 || ^17.0.0" from netlify-cms-app@2.15.72
8:17:21 AM: npm ERR! node_modules/netlify-cms-app
8:17:21 AM: npm ERR! netlify-cms-app@"2.15.72" from the root project
8:17:21 AM: npm ERR! peer netlify-cms-app@"^2.9.0" from gatsby-plugin-netlify-cms@6.18.0
8:17:21 AM: npm ERR! node_modules/gatsby-plugin-netlify-cms
8:17:21 AM: npm ERR! gatsby-plugin-netlify-cms@"6.18.0" from the root project
8:17:21 AM: npm ERR!
8:17:21 AM: npm ERR! Fix the upstream dependency conflict, or retry
8:17:21 AM: npm ERR! this command with --force, or --legacy-peer-deps
8:17:21 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
8:17:21 AM: npm ERR!
8:17:21 AM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
8:17:21 AM: npm ERR! A complete log of this run can be found in:
8:17:21 AM: npm ERR! /opt/buildhome/.npm/_logs/2022-07-18T22_17_18_227Z-debug-0.log
8:17:21 AM: Error during NPM install
8:17:21 AM: Build was terminated: Build script returned non-zero exit code: 1
8:17:21 AM: Failing build: Failed to build site
8:17:21 AM: Finished processing build request in 13.624618749s
Just following on from this, I am unable to get the dependency conflict on my local, even after removing node_modules and lock file and reinstalling.
I was able to get the netlify build passed the dependency issue, by setting the following in my netlify.toml file, with the NPM and node version I am using locally.
Its using the same code base as the first one, the only difference is I’m using typescript on this build. I have commented out the initalisation of the gatsby-plugin-manifest plugin in gatsby-config for this build and the builds in netlify are now working.
Could you also confirm that the image /src/img/icon.png is in the committed repo? Could you share a screenshot of the file structure or share the repo itself?
Or try cloning the repo from git in a different folder to confirm the image is in the repo?
@audrey I’m unable to share access to the repo, but I can confirm the image is in the correct folder in the repo:
I also tried cloning the repo down again into another folder, as you suggested, to make sure the image existed and that it was corrupted.
I also tried another PNG completely, and renaming this image, and changing the folder it was in, as well as changing the image to be a JPG and deleting the cache from .git with git rm --cached .\src\img\favicon.png, but I get the same error message each time.
Hey @cdennington ! While we don’t have a good team email to “invite” to your github repo (we have a mailing list that we cannot “login” to git providers using), you can instead clone your repo, and make a zipfile, and share it with us via your favorite filesharing service (google drive works well and should be free). to the address I am about to DM you (it will end in @netlify.com). That will let our Support team access it collectively so we can collaborate on trying to find a fix for your situation.
Thanks @fool, I actually had a bit of time today and thought I’d create a minimal reproduction for you.
That then lead me to notice the image in github looked broken on my current repo, see screenshot below. but on the minimal reproduction the image loaded and I wasnt running into the same issue.
I’ve changed the PNG in the problem repo to a SVG, and the problem has disappeared.
Its a weird issue as the image doesn’t appear to actually be broken within the repo, if I clone the repo out again the image works without issue, and the image works looks as a PNG running the build command.
I think it probably has something to do with LFS, which I added and then removed, but maybe for some reason Github/GIT is caching the path to the LFS file rather than the image itself, I followed the below link to remove LFS, and Ive run git lfs ls-files again and theres no files.
I’d also tried renaming and moving the file, which you’d think would bust cache, but it also had no affect.
@hrishikesh thanks, that’s good to know. I will confirm with guthub they have been successfully deleted.
If you see my comments above, I have actually already copied to a fresh repo, and experienced the same issue, which also explains my confusion around why it would be an issue with LFS.
Just to summarise, the original issue occurred on the site https://strong-cannoli-27ad08.netlify.app/ which is attached to a repo called paul-gawman, which you can see in the screenshots above.
At roughly the same time I started another job for another client, and copied the code from this repo into a new repo within Github, this site can be accessed at the following URL and experienced the same issue, but this new repo I didn’t set up LFS, however I did copy the .gitattributes file which did have the LFS reference still in it, which may have caused the same issue, although other imagery on the site worked as expected.
Sounds like you have found the root cause-- after you contact github, would you be willing to share what your final takeaway is? I think it would definitely benefit future forums members who encounter something similar.
@hillary I did find the root cause, and it turned out not to be LFS
For those of you who have had LFS added toa repo, and have then removed it, but are seeing this issue, it is a good idea to follow the steps here, as this was part of the issue.
However the solution for me was to change a line in my .gitattributes file from * text eol=crlf to * text=auto eol=crlf.
This line had been added to make sure myself and the other developer on these projects pushed code into the repo with the correct line endings, but I noticed it was also changing image files, which would then fail on build. Adding text=auto tells it to only change line endings in text or binary files and not in images, I had to recommit the image, but this fixed the issue.