Support Forums

Deployment fails

I’m having difficulties to learning how to deploy on Netlify .could you please help.
this is my error.

10:25:52 PM: Build ready to start
10:25:54 PM: build-image version: 3bcb38c35508b42e9121d4badfe6d8c66fd7a3f0
10:25:54 PM: build-image tag: v4.3.2
10:25:54 PM: buildbot version: 65411f2e7f69c7fa96d0462983efb6ddda1b2bc8
10:25:54 PM: Fetching cached dependencies
10:25:54 PM: Failed to fetch cache, continuing with build
10:25:54 PM: Starting to prepare the repo for build
10:25:55 PM: No cached dependencies found. Cloning fresh repo
10:25:55 PM: git clone GitHub - Arpigouswami/my-profile
10:25:56 PM: Preparing Git Reference refs/heads/master
10:25:56 PM: Parsing package.json dependencies
10:25:56 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: ‘dist’ versus ‘dist/’ in the Netlify UI
10:25:57 PM: Starting build script
10:25:57 PM: Installing dependencies
10:25:57 PM: Python version set to 2.7
10:25:57 PM: Downloading and installing node v16.12.0…
10:25:58 PM: Downloading https://nodejs.org/dist/v16.12.0/node-v16.12.0-linux-x64.tar.xz
10:25:58 PM: Computing checksum with sha256sum
10:25:58 PM: Checksums matched!
10:26:01 PM: Now using node v16.12.0 (npm v8.1.0)
10:26:01 PM: Started restoring cached build plugins
10:26:01 PM: Finished restoring cached build plugins
10:26:02 PM: Attempting ruby version 2.7.2, read from environment
10:26:03 PM: Using ruby version 2.7.2
10:26:03 PM: Using PHP version 8.0
10:26:03 PM: Started restoring cached node modules
10:26:03 PM: Finished restoring cached node modules
10:26:04 PM: Installing NPM modules using NPM version 8.1.0
10:26:06 PM: npm ERR! code ERESOLVE
10:26:06 PM: npm ERR! ERESOLVE unable to resolve dependency tree
10:26:06 PM: npm ERR!
10:26:06 PM: npm ERR! While resolving: simplefolio@1.0.1
10:26:06 PM: npm ERR! Found: webpack@5.59.1
10:26:06 PM: npm ERR! node_modules/webpack
10:26:06 PM: npm ERR! dev webpack@"^5.40.0" from the root project
10:26:06 PM: npm ERR!
10:26:06 PM: npm ERR! Could not resolve dependency:
10:26:06 PM: npm ERR! peer webpack@"^4.0.0" from optimize-css-assets-webpack-plugin@6.0.1
10:26:06 PM: npm ERR! node_modules/optimize-css-assets-webpack-plugin
10:26:06 PM: npm ERR! dev optimize-css-assets-webpack-plugin@"^6.0.1" from the root project
10:26:06 PM: npm ERR!
10:26:06 PM: npm ERR! Fix the upstream dependency conflict, or retry
10:26:06 PM: npm ERR! this command with --force, or --legacy-peer-deps
10:26:06 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
10:26:06 PM: npm ERR!
10:26:06 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
10:26:06 PM: npm ERR! A complete log of this run can be found in:
10:26:06 PM: Creating deploy upload records
10:26:06 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-10-23T21_26_06_626Z-debug.log
10:26:06 PM: Error during NPM install
10:26:06 PM: Build was terminated: Build script returned non-zero exit code: 1
10:26:06 PM: Failing build: Failed to build site
10:26:06 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1
10:26:06 PM: Finished processing build request in 12.164295014s

Hi @Arpita

There is a webpack version conflict where one version is found, while a different version is required as a dependency of another package.

The fix is provided:

Either upgrade/downgrade the dependencies you are using in order to satisfy all packages, otherwise you can use NPM_FLAGS environment variable to pass either --force or --legacy-peer-deps to work around the dependency issue.

I’m sorry , but couldn’t understand your response because I just started to use that.
so could you please describe this bit more.
Thank you :blush:

Hi @Arpita,

You need to follow this to declare a variable:

The variable name would be NPM_FLAGS and value would be --force or --legacy-peer-deps.