Home
Support Forums

"Cannot find module" error on one site but not occurring on the exact same config for another site

I have two sites:

staging-play-cinesend.netlify.app

staging-play2-cinesend.netlify.app

The original site is encountering this error:

8:11:57 AM: $ CI=false && npm run build-staging
8:11:57 AM: > cinesend-on-demand-client@0.1.0 build-staging /opt/build/repo
8:11:57 AM: > cp ./build_config/staging.js ./src/config.js && react-scripts build && cp _redirects build/_redirects
8:11:59 AM: Creating an optimized production build...
8:12:02 AM: Browserslist: caniuse-lite is outdated. Please run:
8:12:02 AM: npx browserslist@latest --update-db
8:13:08 AM: Failed to compile.
8:13:08 AM: ./node_modules/mml-react/dist/mml-react.esm.js
8:13:08 AM: Cannot find module: '@rgrove/parse-xml'. Make sure this package is installed.
8:13:08 AM: You can install this package by running: yarn add @rgrove/parse-xml.
8:40:21 AM: Build exceeded maximum allowed runtime

My 2nd site builds right past that:

9:21:39 AM: $ CI=false && npm run build-staging
9:21:39 AM: > cinesend-on-demand-client@0.1.0 build-staging /opt/build/repo
9:21:39 AM: > cp ./build_config/staging.js ./src/config.js && react-scripts build && cp _redirects build/_redirects
9:21:40 AM: Creating an optimized production build...
9:21:41 AM: Browserslist: caniuse-lite is outdated. Please run:
9:21:41 AM: npx browserslist@latest --update-db
9:24:11 AM: Compiled with warnings.

Both are using the same repository and same branch.

My “dev” version of this site is also working fine (same repository, different branch but the codebase is the same atm).

I’ve tried the “Clear cache and deploy site” option. Is there something else I can run to somehow reset the original? Or do I need to move all my site’s subdomains to the new site, rename the old site to some test name, and name the new site to the old site name?

I’m not sure if bumping threads is bad practice but hoping to get some more eyes on this.

Any ideas?

I wonder if this is helpful, I’m noticing this message when the site fails:

3:14:03 PM: info @rgrove/parse-xml@3.0.0: The engine "node" is incompatible with this module. Expected version ">=12.0.0". Got "10.24.1"
3:14:03 PM: info "@rgrove/parse-xml@3.0.0" is an optional dependency and failed compatibility check. Excluding it from installation.

So depending on what version of “node” is installed, we are optionally installing this package, which then causes an issue trying to find the module later, I assume.

Even though the repository and branch are the same, one site is using a different version of node?

Netlify’s build images use node 10 as it comes with xenial by default. You can specify the node version by setting an environment variable NODE_ENV with the standard semver syntax (e.g. 14.17.1) if you want.

(This doesn’t answer the original inconsistency problem I don’t know why they would be different but manually bumping the node version will make them consistent for sure)

In any case it seems like specifying NODE_VERSION as 12 in the “Build & Deploy” => “Environment Variables” setting has resolved this issue.

IMO, there should definitely be some kind of indication that the sites may be operating differently depending on when they were created.

1 Like