Gatsby App deployment fails - cannot find package in .cache

Gatsby app deployment fails due to it being unable to find packages in .cache.

Works locally but when deploying on render it fails.

Here are the relevant parts of the logs

web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve 'mitt' in '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that 'mitt' is installed. If you're
web-app:build: trying to use a local file make sure that the path is correct.
web-app:build: 
web-app:build: File: .cache/emitter.js:1:0
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve 'shallow-compare' in '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that 'shallow-compare' is installed.
web-app:build:  If you're trying to use a local file make sure that the path is correct.
web-app:build: 
web-app:build: File: .cache/ensure-resources.js:1:143
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve '@gatsbyjs/reach-router' in
web-app:build: '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that '@gatsbyjs/reach-router' is
web-app:build: installed. If you're trying to use a local file make sure that the path is
web-app:build: correct.
web-app:build: 
web-app:build: File: .cache/find-path.js:1:0
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve 'gatsby-react-router-scroll' in
web-app:build: '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that 'gatsby-react-router-scroll' is
web-app:build:  installed. If you're trying to use a local file make sure that the path is
web-app:build: correct.
web-app:build: 
web-app:build: File: .cache/gatsby-browser-entry.js:1:508
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve 'gatsby-link' in '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that 'gatsby-link' is installed. If
web-app:build: you're trying to use a local file make sure that the path is correct.
web-app:build: 
web-app:build: File: .cache/gatsby-browser-entry.js:1:569
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve 'gatsby-script' in '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that 'gatsby-script' is installed.
web-app:build: If you're trying to use a local file make sure that the path is correct.
web-app:build: 
web-app:build: File: .cache/gatsby-browser-entry.js:1:779
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve '@gatsbyjs/reach-router' in
web-app:build: '/opt/render/project/src/apps/web-app/.cache/head'
web-app:build: 
web-app:build: If you're trying to use a package make sure that '@gatsbyjs/reach-router' is
web-app:build: installed. If you're trying to use a local file make sure that the path is
web-app:build: correct.
web-app:build: 
web-app:build: File: .cache/head/head-export-handler-for-browser.js:1:170
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve '@gatsbyjs/reach-router' in
web-app:build: '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that '@gatsbyjs/reach-router' is
web-app:build: installed. If you're trying to use a local file make sure that the path is
web-app:build: correct.
web-app:build: 
web-app:build: File: .cache/navigation.js:1:332
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve 'gatsby-link' in '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that 'gatsby-link' is installed. If
web-app:build: you're trying to use a local file make sure that the path is correct.
web-app:build: 
web-app:build: File: .cache/navigation.js:1:408
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve 'prop-types' in '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that 'prop-types' is installed. If
web-app:build: you're trying to use a local file make sure that the path is correct.
web-app:build: 
web-app:build: File: .cache/page-renderer.js:1:49
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve '@gatsbyjs/reach-router' in
web-app:build: '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that '@gatsbyjs/reach-router' is
web-app:build: installed. If you're trying to use a local file make sure that the path is
web-app:build: correct.
web-app:build: 
web-app:build: File: .cache/production-app.js:1:153
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve 'gatsby-react-router-scroll' in
web-app:build: '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that 'gatsby-react-router-scroll' is
web-app:build:  installed. If you're trying to use a local file make sure that the path is
web-app:build: correct.
web-app:build: 
web-app:build: File: .cache/production-app.js:1:226
web-app:build: 
web-app:build: 
web-app:build:  ELIFECYCLE  Command failed with exit code 1.
web-app:build: ERROR: command finished with error: command (/opt/render/project/src/apps/web-app) pnpm run build exited (1)
web-app#build: command (/opt/render/project/src/apps/web-app) pnpm run build exited (1)
 Tasks:    3 successful, 4 total
Cached:    0 cached, 4 total
  Time:    1m52.77s 
Failed:    web-app#build
 ERROR  run failed: command  exited (1)
 ELIFECYCLE  Command failed with exit code 1.
==> Build failed 😞
==> Common ways to troubleshoot your deploy: https://docs.render.com/troubleshooting-deploys
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve '@gatsbyjs/reach-router' in
web-app:build: '/opt/render/project/src/apps/web-app/.cache/head'
web-app:build: 
web-app:build: If you're trying to use a package make sure that '@gatsbyjs/reach-router' is
web-app:build: installed. If you're trying to use a local file make sure that the path is
web-app:build: correct.
web-app:build: 
web-app:build: File: .cache/head/head-export-handler-for-browser.js:1:170
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve '@gatsbyjs/reach-router' in
web-app:build: '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that '@gatsbyjs/reach-router' is
web-app:build: installed. If you're trying to use a local file make sure that the path is
web-app:build: correct.
web-app:build: 
web-app:build: File: .cache/navigation.js:1:332
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve 'gatsby-link' in '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that 'gatsby-link' is installed. If
web-app:build: you're trying to use a local file make sure that the path is correct.
web-app:build: 
web-app:build: File: .cache/navigation.js:1:408
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve 'prop-types' in '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that 'prop-types' is installed. If
web-app:build: you're trying to use a local file make sure that the path is correct.
web-app:build: 
web-app:build: File: .cache/page-renderer.js:1:49
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve '@gatsbyjs/reach-router' in
web-app:build: '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that '@gatsbyjs/reach-router' is
web-app:build: installed. If you're trying to use a local file make sure that the path is
web-app:build: correct.
web-app:build: 
web-app:build: File: .cache/production-app.js:1:153
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve 'gatsby-react-router-scroll' in
web-app:build: '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that 'gatsby-react-router-scroll' is
web-app:build:  installed. If you're trying to use a local file make sure that the path is
web-app:build: correct.
web-app:build: 
web-app:build: File: .cache/production-app.js:1:226
web-app:build: 
web-app:build: 
web-app:build:  ELIFECYCLE  Command failed with exit code 1.
web-app:build: ERROR: command finished with error: command (/opt/render/project/src/apps/web-app) pnpm run build exited (1)
web-app#build: command (/opt/render/project/src/apps/web-app) pnpm run build exited (1)
 Tasks:    3 successful, 4 total
Cached:    0 cached, 4 total
  Time:    1m52.77s 
Failed:    web-app#build
 ERROR  run failed: command  exited (1)
 ELIFECYCLE  Command failed with exit code 1.
==> Build failed 😞
==> Common ways to troubleshoot your deploy: https://docs.render.com/troubleshooting-deploys
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve '@gatsbyjs/reach-router' in
web-app:build: '/opt/render/project/src/apps/web-app/.cache/head'
web-app:build: 
web-app:build: If you're trying to use a package make sure that '@gatsbyjs/reach-router' is
web-app:build: installed. If you're trying to use a local file make sure that the path is
web-app:build: correct.
web-app:build: 
web-app:build: File: .cache/head/head-export-handler-for-browser.js:1:170
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve '@gatsbyjs/reach-router' in
web-app:build: '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that '@gatsbyjs/reach-router' is
web-app:build: installed. If you're trying to use a local file make sure that the path is
web-app:build: correct.
web-app:build: 
web-app:build: File: .cache/navigation.js:1:332
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve 'gatsby-link' in '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that 'gatsby-link' is installed. If
web-app:build: you're trying to use a local file make sure that the path is correct.
web-app:build: 
web-app:build: File: .cache/navigation.js:1:408
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve 'prop-types' in '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that 'prop-types' is installed. If
web-app:build: you're trying to use a local file make sure that the path is correct.
web-app:build: 
web-app:build: File: .cache/page-renderer.js:1:49
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve '@gatsbyjs/reach-router' in
web-app:build: '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that '@gatsbyjs/reach-router' is
web-app:build: installed. If you're trying to use a local file make sure that the path is
web-app:build: correct.
web-app:build: 
web-app:build: File: .cache/production-app.js:1:153
web-app:build: 
web-app:build: 
web-app:build: 
web-app:build:  ERROR #98124  WEBPACK.BUILD-JAVASCRIPT
web-app:build: 
web-app:build: Generating JavaScript bundles failed
web-app:build: 
web-app:build: Can't resolve 'gatsby-react-router-scroll' in
web-app:build: '/opt/render/project/src/apps/web-app/.cache'
web-app:build: 
web-app:build: If you're trying to use a package make sure that 'gatsby-react-router-scroll' is
web-app:build:  installed. If you're trying to use a local file make sure that the path is
web-app:build: correct.
web-app:build: 
web-app:build: File: .cache/production-app.js:1:226
web-app:build: 
web-app:build: 
web-app:build:  ELIFECYCLE  Command failed with exit code 1.

Hi there,

I see quite a few messages that make it sound like dependencies are not being installed. Can you confirm you are running npm install?

Could you share your build command?

Regards,

Matt

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.