Error message change with changing from npm to yarn. Uploadthing doesn't work in either case.

My node.js
import { createUploadthing } from 'uploadthing/express'
const f = createUploadthing()
import { createUploadthing } from 'uploadthing/express'
const f = createUploadthing()
Error when using npm:
file:///home/person/node-project/uploadthing-example/node_modules/uploadthing/dist/chunk-T2XS27LC.mjs:12
throw new Error('Dynamic require of "' + x + '" is not supported');
Error: Dynamic require of "path" is not supported
file:///home/person/node-project/uploadthing-example/node_modules/uploadthing/dist/chunk-T2XS27LC.mjs:12
throw new Error('Dynamic require of "' + x + '" is not supported');
Error: Dynamic require of "path" is not supported
Error when using yarn
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'zod' imported from /home/person//node-project/uploadthing-example/node_modules/@uploadthing/shared/dist/
index.mjs
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'zod' imported from /home/person//node-project/uploadthing-example/node_modules/@uploadthing/shared/dist/
index.mjs
So I manually installed zod with yarn add zod and got the same message as npm
file: ///home/person/uploadthing-example/node_modules/uploadthing/dist/chunk-T2XS27LC.mjs:12
throw new Error('Dynamic require of "' + x + '" is not supported');
^

Error: Dynamic require of "path" is not supported
at file: ///home/person/uploadthing-example/node_modules/uploadthing/dist/chunk-T2XS27LC.mjs:12:9
at ../../node_modules/.pnpm/[email protected]/node_modules/depd/index.js (file: ///home/person/uploadthing-example/node_modules/uploadthing/dis
t/express.mjs: 20: 20)
at __require2 (file: ///home/person/uploadthing-example/node_modules/uploadthing/dist/chunk-T2XS27LC.mjs:15:50)
at ../../node_modules/.pnpm/[email protected]/node_modules/body-parser/index.js (file: ///home/person/uploadthing-example/node_modules/
uploadthing/dist/express.mjs: 16511: 21)
at __require2 (file: ///home/person/uploadthing-example/node_modules/uploadthing/dist/chunk-T2XS27LC.mjs:15:50)
at ../../node_modules/.pnpm/[email protected]/node_modules/express/lib/express.js (file: ///home/person/uploadthing-...
Node.js v18.17.1
file: ///home/person/uploadthing-example/node_modules/uploadthing/dist/chunk-T2XS27LC.mjs:12
throw new Error('Dynamic require of "' + x + '" is not supported');
^

Error: Dynamic require of "path" is not supported
at file: ///home/person/uploadthing-example/node_modules/uploadthing/dist/chunk-T2XS27LC.mjs:12:9
at ../../node_modules/.pnpm/[email protected]/node_modules/depd/index.js (file: ///home/person/uploadthing-example/node_modules/uploadthing/dis
t/express.mjs: 20: 20)
at __require2 (file: ///home/person/uploadthing-example/node_modules/uploadthing/dist/chunk-T2XS27LC.mjs:15:50)
at ../../node_modules/.pnpm/[email protected]/node_modules/body-parser/index.js (file: ///home/person/uploadthing-example/node_modules/
uploadthing/dist/express.mjs: 16511: 21)
at __require2 (file: ///home/person/uploadthing-example/node_modules/uploadthing/dist/chunk-T2XS27LC.mjs:15:50)
at ../../node_modules/.pnpm/[email protected]/node_modules/express/lib/express.js (file: ///home/person/uploadthing-...
Node.js v18.17.1
2 Replies
Josh
Josh15mo ago
1: did you make sure to reinstall all your packages? 2: are you on node 18+?
o_O
o_OOP15mo ago
1. yes, I did it in a different directory when i installed with yarn. Now have two complelty seperate folders. One with yarn and other with npm. I didn't mix and match my package managers. 2. As seen in the error message I'm running node v18.17.1
Want results from more Discord servers?
Add your server