Skip to content

[Bug]: Cannot find module 'next/dist/build/analysis/extract-const-value' #1690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks
stwilz opened this issue Oct 17, 2022 · 7 comments · Fixed by #1691
Closed
2 tasks

[Bug]: Cannot find module 'next/dist/build/analysis/extract-const-value' #1690

stwilz opened this issue Oct 17, 2022 · 7 comments · Fixed by #1691
Assignees
Labels
priority: high type: bug code to address defects in shipped code

Comments

@stwilz
Copy link

stwilz commented Oct 17, 2022

Summary

Hey there,

We just ran a deploy after the latest plugin release and we are getting the following issue.

Error: Cannot find module 'next/dist/build/analysis/extract-const-value'
Require stack:

/opt/build/repo/web/.netlify/plugins/node_modules/@netlify/plugin-nextjs/lib/helpers/analysis.js
/opt/build/repo/web/.netlify/plugins/node_modules/@netlify/plugin-nextjs/lib/helpers/functions.js
/opt/build/repo/web/.netlify/plugins/node_modules/@netlify/plugin-nextjs/lib/index.js
While loading "@netlify/plugin-nextjs" from Netlify app at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15) at Function.Module._load (node:internal/modules/cjs/loader:833:27) at Module.require (node:internal/modules/cjs/loader:1057:19) at require (node:internal/modules/cjs/helpers:103:18) at Object. (/opt/build/repo/web/.netlify/plugins/node_modules/@netlify/plugin-nextjs/lib/helpers/analysis.js:28:31) at Module._compile (node:internal/modules/cjs/loader:1155:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10) at Module.load (node:internal/modules/cjs/loader:1033:32) at Function.Module._load (node:internal/modules/cjs/loader:868:12) at Module.require (node:internal/modules/cjs/loader:1057:19)

Error properties: { code: 'MODULE_NOT_FOUND' }

Steps to reproduce

  1. Trigger Build

A link to a reproduction repository

No response

Next Runtime version

4.27.0

More information about your build

  • I am building using the CLI
  • I am building using file-based configuration (netlify.toml)

What OS are you using?

No response

Your netlify.toml file

[build]
base = "/web/"
publish = ".next"
command = "yarn build"

Your public/_redirects file

No response

Your next.config.js file

// const { withSentryConfig } = require('@sentry/nextjs')

/** @type {import('next').NextConfig} /
const nextConfig = {
reactStrictMode: true,
images: {
domains: ['cdn.sanity.io'],
deviceSizes: [768, 1280, 1440, 1700],
imageSizes: [45, 375, 710],
},
redirects: async () => [
{
source: '/',
has: [
{
type: 'cookie',
key: 'centreSlug',
value: '(?.
)',
},
],
destination: '/:centreSlug',
permanent: false,
},
{
source: '/',
destination: '/intro',
permanent: false,
},
],
}
module.exports = nextConfig

Builds logs (or link to your logs)

Build logs
# Paste logs here

Function logs

Function logs
# Paste logs here

.next JSON files

generated .next JSON files
# Paste file contents here. Please check there isn't any private info in them
# You can either build locally, or download the deploy from Netlify by clicking the arrow next to the deploy time.
@stwilz stwilz added the type: bug code to address defects in shipped code label Oct 17, 2022
@gfirem
Copy link

gfirem commented Oct 18, 2022

It's happening in my project too. Any help is welcome

@stwilz
Copy link
Author

stwilz commented Oct 18, 2022

@gfirem I've managed to resolve this by upgrading our node packages. We are now using next 12.3.1 + react 18.2.0 and builds are resuming.

@kloogans
Copy link

@gfirem I've managed to resolve this by upgrading our node packages. We are now using next 12.3.1 + react 18.2.0 and builds are resuming.

this worked for me as well. thanks!

@GainorB
Copy link

GainorB commented Oct 18, 2022

@gfirem I've managed to resolve this by upgrading our node packages. We are now using next 12.3.1 + react 18.2.0 and builds are resuming.

this also worked for me!

@Kimbyungkwan
Copy link

Kimbyungkwan commented Oct 18, 2022

Thanks😄, Only updated "nextjs" and it worked for me, next 11.1.0(😅) -> 12.3.1

@marika-jane
Copy link

Thanks for this! I am using React version 17.0.2, and only updating Next from 12.1.0 to 12.3.1 has solved it for me! 🥳

@ascorbic
Copy link
Contributor

Thanks for the report. The workaround is to upgrade Next.js, but I will put out a fix to work wiht older versions today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: high type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants