Skip to content
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

TypeError: Class extends value undefined is not a constructor or null #35

Closed
mwoodpatrick opened this issue May 29, 2021 · 7 comments
Closed

Comments

@mwoodpatrick
Copy link

When building I'm getting the following error with latest packages and node v16.2.0 (npm v7.13.0)

TypeError: Class extends value undefined is not a constructor or null
at Object.618 (/home/mwoodpatrick/projects/git/www/nextjs-wp/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:100)
at nccwpck_require (/home/mwoodpatrick/projects/git/www/nextjs-wp/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11843)
at Object.270 (/home/mwoodpatrick/projects/git/www/nextjs-wp/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:413)
at nccwpck_require (/home/mwoodpatrick/projects/git/www/nextjs-wp/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11843)

at Object.327 (/home/mwoodpatrick/projects/git/www/nextjs-wp/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:260)
at __nccwpck_require__ (/home/mwoodpatrick/projects/git/www/nextjs-wp/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11843)
at Object.845 (/home/mwoodpatrick/projects/git/www/nextjs-wp/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:3733)
at __nccwpck_require__ (/home/mwoodpatrick/projects/git/www/nextjs-wp/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11843)
at /home/mwoodpatrick/projects/git/www/nextjs-wp/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11971
at Object.<anonymous> (/home/mwoodpatrick/projects/git/www/nextjs-wp/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11997)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
@leerob
Copy link
Member

leerob commented May 31, 2021

Is your code identical to the working examples here?

@mwoodpatrick
Copy link
Author

I had added more modules but recreating package-lock.json and node_modules fixed my problem and I was able to deploy to Vercel

@bayram00
Copy link

i have a problem like this too

error - Error [TypeError]: Class extends value undefined is not a constructor or null
at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/file.js (evalmachine.:5724:19)
at __require (evalmachine.:14:50)
at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/formdata.js (evalmachine.:5881:49)
at __require (evalmachine.:14:50)
at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/body.js (evalmachine.:6094:35)
at __require (evalmachine.:14:50)
at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/response.js (evalmachine.:6510:49)
at __require (evalmachine.:14:50)
at (evalmachine.:11635:30)
at requireFn (file://C:\Users\Bayram\Desktop\nextapi\node_modules\next\dist\compiled\edge-runtime\index.js:1:7079) {
middleware: true

@fernandolucchesi
Copy link

i have a problem like this too

error - Error [TypeError]: Class extends value undefined is not a constructor or null at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/file.js (evalmachine.:5724:19) at __require (evalmachine.:14:50) at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/formdata.js (evalmachine.:5881:49) at __require (evalmachine.:14:50) at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/body.js (evalmachine.:6094:35) at __require (evalmachine.:14:50) at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/response.js (evalmachine.:6510:49) at __require (evalmachine.:14:50) at (evalmachine.:11635:30) at requireFn (file://C:\Users\Bayram\Desktop\nextapi\node_modules\next\dist\compiled\edge-runtime\index.js:1:7079) { middleware: true

same, happening after upgraded to next 13

@fernandolucchesi
Copy link

i have a problem like this too

error - Error [TypeError]: Class extends value undefined is not a constructor or null at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/file.js (evalmachine.:5724:19) at __require (evalmachine.:14:50) at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/formdata.js (evalmachine.:5881:49) at __require (evalmachine.:14:50) at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/body.js (evalmachine.:6094:35) at __require (evalmachine.:14:50) at ../../node_modules/.pnpm/undici@5.11.0/node_modules/undici/lib/fetch/response.js (evalmachine.:6510:49) at __require (evalmachine.:14:50) at (evalmachine.:11635:30) at requireFn (file://C:\Users\Bayram\Desktop\nextapi\node_modules\next\dist\compiled\edge-runtime\index.js:1:7079) { middleware: true

Upgrading node fixes this. Check: vercel/next.js#42729

@maniatoffl
Copy link

Updating Node version didn't work for me, I had to remove next 13 middleware.ts under src folder, and created custom server.js for handling middlewares. The issue then resolved for me .

@eichgi
Copy link

eichgi commented Mar 24, 2023

@maniatoffl It seems you need to use node v16.4 at least in order to use a middleware.ts file as I did.

Source: https://stackoverflow.com/questions/74739282/next-js13-middleware-occurs-typeerror-class-extends-value-undefined-is-not-a-c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants