0

netlify giving me error cant figure it out. I tried CI= npm run build

knom
  • 1
  • 1
  • Maybe set the title more related to your error. You have a dependency error when installing modules – besjon_c Jun 28 '22 at 23:18

2 Answers2

1

Have you deployed a previous version of this project to netlify. If so, it's possible that you may want to deploy this as a new project after deleting the original. If not, Netlify has deployment docs, you could look through. Hope this helps!

xqc2987dtg
  • 21
  • 2
0

This errors happened whith node version 16 and later, apparently. The reason is related to package-lock.json module versions. If you do not have a package-lock.json in your repo, the dependency changes every time you build. Some modules might cause dependency errors.

Netlify support suggests you either use a lower version of node when deploying (Just set node version as environmental veriables e.g The NODE_VERSION environment variable, or a .node-version / .nvmrc file.) or use --force when installing the node modules

The error is a peer dependency conflict relating to versions of react, which provides guidance on how you can attempt to resolve it:

Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

It suggests you can run npm install --force or npm install --legacy-peer-deps.

To do this on Netlify you can use the NPM_FLAGS environment variable.

NPM_FLAGS: used to indicate the flags to pass to the npm install command.

Setting it to either --force or --legacy-peer-deps depending on your preference.

To add environmental variables there is a section in your project settings named Envrionment variables

Please, have a look at the Netlify forum: https://answers.netlify.com/t/deploy-failed-today-build-was-terminated-build-script-returned-non-zero-exit-code-1/64450

besjon_c
  • 170
  • 2
  • 12