Deploy failed with message this relative module was not found

Hi, @jomesili, and welcome to our Netlify community site.

I believe this is the most recent build which failed here:

The errors in the logs appear similar errors reported in these places:

https://npm.community/t/enoent-no-such-file-or-directory-errors/8073
https://github.com/visionmedia/debug/issues/261
https://github.com/WordPress/gutenberg/issues/9474

There are a variety of solutions suggested in the pages linked to above. Those range from using rm -rf node_modules && npm install to upgrading the version of node.js being used.

The repo itself is private so I cannot see what it contains and, because of this, I’m only able to make best guesses at the cause and solution.

I would check for the following:

  • Does the version of node being used by the build image match you local version? (If not, use an environment variable to set it.)
  • Is the node_modules/ directory included in the repo? (If so, remove/delete those files from the repo and push those changes upstream.)
  • Is case-sensitivity a factor? (If so, correct all file references to use the correct capitalization as found on the filesystem.)

For that last point, this often happens with MacOS users. MacOS doesn’t care about capitalization in most cases. So, Main.js = main.js on MacOS.

Our build image is Linux and, in most cases, Linux is case sensitive. On Linux ,if the file is named Main.js and you reference it as main.js, you will get file not found errors. Because the build is being done on Linux at Netlify, any incorrect references to files because of non-matching capitalization will need to be corrected for the build to succeed there.

Finally, it also helps to look over the issues mentioned in the community topic below:

If none of these solutions work, please let us know.

1 Like