Home
Support Forums

Node module install error, need to use "force" but don't know how?

Trying to deploy my site: pedantic-bhabha-c3a304.

My error message will be below. Basically, when Netlify is installing node modules, it can’t resolve a dependency discrepancy. I had the same issue when I installed locally, but I was able to use “force” to get through it. Once everything is downloaded my build runs and the website works perfectly on local host. Is there a way to make Netlify force the node module install?

Running into the following error messages:
9:21:17 PM: Build ready to start
9:21:18 PM: build-image version: 3bcb38c35508b42e9121d4badfe6d8c66fd7a3f0
9:21:18 PM: build-image tag: v4.3.2
9:21:18 PM: buildbot version: 39428daf62968de16b6279e22b981b8b656d5e02
9:21:18 PM: Building without cache
9:21:18 PM: Starting to prepare the repo for build
9:21:19 PM: No cached dependencies found. Cloning fresh repo
9:21:19 PM: git clone GitHub - adamkeenan88/adam-keenan-portfolio
9:21:20 PM: Preparing Git Reference refs/heads/main
9:21:21 PM: Parsing package.json dependencies
9:21:21 PM: Starting build script
9:21:21 PM: Installing dependencies
9:21:21 PM: Python version set to 2.7
9:21:22 PM: Downloading and installing node v16.11.0…
9:21:22 PM: Downloading https://nodejs.org/dist/v16.11.0/node-v16.11.0-linux-x64.tar.xz
9:21:23 PM: Computing checksum with sha256sum
9:21:23 PM: Checksums matched!
9:21:26 PM: Now using node v16.11.0 (npm v8.0.0)
9:21:26 PM: Started restoring cached build plugins
9:21:26 PM: Finished restoring cached build plugins
9:21:26 PM: Attempting ruby version 2.7.2, read from environment
9:21:27 PM: Using ruby version 2.7.2
9:21:28 PM: Using PHP version 8.0
9:21:28 PM: Started restoring cached node modules
9:21:28 PM: Finished restoring cached node modules
9:21:28 PM: Installing NPM modules using NPM version 8.0.0
9:21:31 PM: npm ERR! code ERESOLVE
9:21:31 PM: npm ERR! ERESOLVE unable to resolve dependency tree
9:21:31 PM: npm ERR!
9:21:31 PM: npm ERR! While resolving: simplefolio@1.0.1
9:21:31 PM: npm ERR! Found: webpack@5.58.1
9:21:31 PM: npm ERR! node_modules/webpack
9:21:31 PM: npm ERR! dev webpack@"^5.40.0" from the root project
9:21:31 PM: npm ERR!
9:21:31 PM: npm ERR! Could not resolve dependency:
9:21:31 PM: npm ERR! peer webpack@"^4.0.0" from optimize-css-assets-webpack-plugin@4.0.3
9:21:31 PM: npm ERR! node_modules/optimize-css-assets-webpack-plugin
9:21:31 PM: Creating deploy upload records
9:21:31 PM: npm ERR! dev optimize-css-assets-webpack-plugin@"^4.0.0" from the root project
9:21:31 PM: npm ERR!
9:21:31 PM: npm ERR! Fix the upstream dependency conflict, or retry
9:21:31 PM: npm ERR! this command with --force, or --legacy-peer-deps
9:21:31 PM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
9:21:31 PM: npm ERR!
9:21:31 PM: npm ERR! See /opt/buildhome/.npm/eresolve-report.txt for a full report.
9:21:31 PM: npm ERR! A complete log of this run can be found in:
9:21:31 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-10-10T02_21_31_045Z-debug.log
9:21:31 PM: Error during NPM install
9:21:31 PM: Build was terminated: Build script returned non-zero exit code: 1
9:21:31 PM: Failing build: Failed to build site
9:21:31 PM: Failed during stage ‘building site’: Build script returned non-zero exit code: 1
9:21:31 PM: Finished processing build request in 12.396982893s

Hi @adamkeenan88

Yes, there is. You need to use the NPM_FLAGS environment variable.

(Note: You can also do this using file-based configuration.)

A better option (especially for the long-term) is to resolve the dependency conflict by upgrading packages to the latest, or moving to different packages if currently used packages are deprecated or no longer maintained.

1 Like

Thank you!! That worked for that part. Now it’s throwing an error related to a Child Compilation Failure. I’m using a template so I think there may be some older modules or something messing it up but I don’t know what to change because it’s not my work. If you have any suggestions for that I’m all eyes, but I’ll keep messing with it.

Without seeing the specific errors it is a little hard to make suggestions. Can you share the relevant part of the deploy log here, or the URL to the deploy log if you have public logs enabled.

https://app.netlify.com/sites/pedantic-bhabha-c3a304/deploys/6162e1e67d2d691d4e5e1a5e

Thanks @adamkeenan88

Parse Error: < studyBuddy /></h3>

This is because < studyBuddy /> is getting parsed as a HTML tag or component that doesn’t exist. So in src/template.html change

<h3 class="project-wrapper__text-title">< studyBuddy /></h3>

to

<h3 class="project-wrapper__text-title">&lt; studyBuddy /&gt;</h3>

The &lt; and &gt; are then changed to < and > when the page is viewed in the browser.

1 Like

You’re amazing!! Thank you so much. I struggled so hard last night until my computer died. Thanks!

1 Like

Amazing!? Not IMHO. Happy to help.

1 Like