Deploy failed with message this relative module was not found

Please find below an error I am having.

9:07:44 AM: - Building for production…
9:07:45 AM: ERROR Failed to compile with 1 errors8:07:45 AM
9:07:45 AM: This relative module was not found:
9:07:45 AM: * ./src/main.js in multi ./src/main.js
9:07:45 AM: ERROR Build failed with errors.
9:07:46 AM: npm
9:07:46 AM: ERR! code

I am not quite sure where this error stems from I do not have a folder called “multi” on my local repo;

Any help is highly appreciated

hi @jomesili - welcome. is this a local build or are you trying to build on Netlify?

we always request you verify that things work locally before trying to deploy.

If you need more help, please make sure you tell us your netlify username, and what you have already tried to fix the issue :slight_smile:

Thanks for the reply Perry, yes it is a local build and it works as expected on my system. I have uploaded all the files to Github and tried the deployment. I m faced with the error .What else can I provide you to help with information describing the situation

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:

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