node-server icon indicating copy to clipboard operation
node-server copied to clipboard

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

Open thathurtabit opened this issue 1 year ago • 3 comments

Hello. I'm not sure if this is down to always annoying CJS/MJS issue(s), but when building my app through Docker, I get the following error, despite being able to build the app successfully when running locally.

Error:

 ⠋ Container atds-usage-reports-app-1  Recreated                                                                                                                                                                          0.0s 
Attaching to app-1
app-1  | /usr/local/namespace/app/node_modules/@hono/node-server/dist/index.js:46
app-1  | var Request = class extends GlobalRequest {
app-1  |               ^
app-1  | 
app-1  | TypeError: Class extends value undefined is not a constructor or null
app-1  |     at Object.<anonymous> (/usr/local/namespace/app/node_modules/@hono/node-server/dist/index.js:46:15)
app-1  |     at Module._compile (node:internal/modules/cjs/loader:1369:14)
app-1  |     at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
app-1  |     at Module.load (node:internal/modules/cjs/loader:1206:32)
app-1  |     at Module._load (node:internal/modules/cjs/loader:1022:12)
app-1  |     at Module.require (node:internal/modules/cjs/loader:1231:19)
app-1  |     at require (node:internal/modules/helpers:179:18)
app-1  |     at Object.<anonymous> (/usr/local/autotrader/app/dist/index.js:3:23)
app-1  |     at Module._compile (node:internal/modules/cjs/loader:1369:14)
app-1  |     at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
app-1  | 
app-1  | Node.js v20.12.1
app-1 exited with code 1

Looking at my node_modules locally (node_modules/@hono/node-server/dist/index.js:46:15) things do seem to be fine.

Screenshot 2024-04-15 at 15 44 40

I'm really confused as to why by build (only in Docker) seems to not know about the GlobalRequest class declared above.

thathurtabit avatar Apr 15 '24 14:04 thathurtabit

I am also having this error when trying to build Vite on GitHub Pages. Everything checks off locally, dev/build/preview

`at file:///home/runner/work/.../node_modules/@hono/node-server/dist/index.mjs:20:15`

charlieforward9 avatar Jul 04 '24 04:07 charlieforward9

Dependent issue: https://github.com/aidenybai/million/issues/1071

charlieforward9 avatar Jul 04 '24 05:07 charlieforward9

Old node version I guess

abhishiv avatar Aug 06 '24 02:08 abhishiv