mike-marcacci / fs-capacitor

Filesystem-bufferred, passthrough stream that buffers indefinitely rather than propagate backpressure from downstream consumers.
MIT License
36 stars 8 forks source link

Can't use with nest js #93

Open Hellomik2002 opened 1 year ago

Hellomik2002 commented 1 year ago

.../clinic-node/dist/src/graphql_upload/processRequest.js:4 const fs_capacitor_1 = require("fs-capacitor"); ^ Error [ERR_REQUIRE_ESM]: require() of ES Module .../clinic-node/node_modules/.pnpm/fs-capacitor@8.0.0/node_modules/fs-capacitor/dist/index.js from .../clinic-node/dist/src/graphql_upload/processRequest.js not supported. Instead change the require of index.js in .../clinic-node/dist/src/graphql_upload/processRequest.js to a dynamic import() which is available in all CommonJS modules. at Object. (.../clinic-node/dist/src/graphql_upload/processRequest.js:4:24) at Object. (.../clinic-node/dist/src/graphql_upload/graphqlUploadExpress.js:14:29) at Object. (.../clinic-node/dist/src/main.js:5:35)

mozsinrb commented 1 year ago

I have the same problem

onzag commented 11 months ago

Same here on my own code that doesn't even use nest js

This is just proof of the immaturity of the NodeJS ecosystem newer packages will not work with good old CommonJS

I recommend you either just copy and paste the source code and don't install via npm, or rewrite your entire codebase including nest js itself to work with esm modules.

This doesn't have to be with the code itself, it's just Node; this is why npm install isn't good.

I will just copy paste since I refuse to refactor my entire codebase.

Allakazan commented 4 months ago

There is a fix to it ?