Home
Support Forums

Deployment fails because of npm modules not found that the app do not directly depend on

Hi,

Builds started failing for annuaire-lanorvege. (Source code).

Latest log (if you can access it internally): Netlify App

The error is: Error: Cannot find module 'color-string'. It was Error: Cannot find module 'source-map-js'. I did not directly depend on source-map-js so I added it in package.json anyway and now it is failing because of color-string but I feel like it’s not the right fix anyway.

Note that netlify dev and netlify build on my local machine running the same node version (v16.13.0) is working without any issues. I am running out of ideas :confused:.

PS: please note that a few hours ago I already tried to created a similar message but that it was detected as spam by your akismet bot. I am this trying again by rewording my message.

Interestingly I added that package to package.json and the build now works.

On a side note, you’ve configured your netlify.toml incorrectly. It’s not related to the build error, but that configuration would not work anyways.

Since you’ve set the base path as web, you need to remove it from publish, so publish should only be out.

I tracked down the failure to the commit where I switched from yarn to npm.

I tried to switched the repo back to yarn but despite a yarn.lock file at the root of the directory I see this in the new logs: 7:36:54 PM: Installing NPM modules using NPM version 8.1.0.

The failure this time is related to ESlint. At first sight it looks like the failure is expected and ESLint is right but I cannot reproduce it locally. I am gonna start from scratch without using a monorepo because I suspect it’s related.