Gatsby Build Error

Hi, it’s a brief problem that render failed to build due to the npm install failure. It requires --legacy-peer-deps to install but I don’t know how to do it. Thanks in advance.

Oh, I just fixed it. I just got the answer from Stack Overflow at this link


We only need to add .npmrc file to the repository, write a line “legacy-peer-deps=true” and then commit it so the deployment will restart with that npm flag. I hope it helps whoever faces the same problem.

Hi there,

You’ve not really shared much information to go on. When asking for help, provide as much information as possible, e.g. any logs/errors/output, specific URLs, reproduction steps, screenshots etc. whatever you think shows the issue and what you’ve tried to resolve it.

From the mention of --legacy-peer-deps it sounds like you have a dependency resolution issue. If you need to manually npm install --legacy-peer-deps you’ll need to add an environment variable of SKIP_INSTALL_DEPS set to true to stop the static site auto dependency installation and you can set your build command exactly as you need.


Glad to hear you found an alternative solution, thanks for sharing with the community.