Build is failing on push but works on "Clean cache and build"

Hello,

I’ve been having an issue with the build failing on Netlify whenever I push a new update to the repository. It started suddenly yesterday and just keeps on re-appearing.

Build log: Hastebin: Send and Save Text or Code Snippets for Free | Toptal®

The build fails saying that dependencies are missing, everything builds fine locally, and if I do a clear cache and deploy site in Netlify, then Netlify builds it just fine as well. The issue only occurs when it builds from a GitHub commit notification.

I’ve started using the NPM module np and publishing to npmjs, the code itself is also a npm package that the build process is depending on. Coding this way is new to me, and it is possible I am doing something wrong in one of the configs due to the nature of how I use the dependencies.

Folder structure
docs/ <— This is the folder being built
– docs/index.js
– docs/package.json
index.js ← This module is included in the build process for docs/
package.json ← Dependencies in this package.json isn’t “found” by Netlify, and the build fails.

I’m not sure if the folder structure and np is related at all, it’s the first time I see this issue and the only real change I have done is making a NPM module that’s also being used in the build.

Edit It seems that if I bump the version number in docs/package.json, then it builds fine when pushed. But I wonder if that is the same as clicking the “Clear cache and build” button? Could there be something wrong on Netlify’s end with caching?

hi there, did you see this guide already?

Thank you for the reponse, the problem seems to have been that I required dependencies in the site Netlify was building in the devDependencies of the module itself, they should have been in dependencies.

1 Like