[ERROR] Could not resolve "fs/promises"
See original GitHub issueWhat version of Remix are you using?
Remix - Cloudflare workers @ latest
Steps to Reproduce
Hello, i’m trying to learn react and remix altogheter, I came across an error, trying to pass a multipart form from frontend to backend via form and action. As i try to import unstable_createMemoryUploadHandler it throws an error related to FS/Promises
17 │ var promises = require('fs/promises');
The package "fs/promises" wasn't found on the file system but is built into node.
Are you trying to bundle for node?
You can use "platform: 'node'" to do that, which will remove this error.
Build failed with 1 error:
node_modules/@remix-run/node/upload/fileUploadHandler.js:17:23: ERROR: Could not resolve "fs/promises"
So basically I don’t understand if I’m doing something wrong. As I could understand on cloudflare workers I have to rely on their services, and so no storage and so no fileUpload, i’m trying to use the stream to get the file posted with the request to pass it to supabase via service role key.
Any idea what am I missing?
Expected Behavior
Should create a uploaderHandle to pass to
export const action: ActionFunction = async ({
request,
}) => {
const uploadHandler = unstable_createMemoryUploadHandler({
maxFileSize: 500_000,
});
const formData = await unstable_parseMultipartFormData(
request,
uploadHandler
);
const file = formData.get("avatar");
// file is a "File" (https://mdn.io/File) polyfilled for node
// ... etc
Actual Behavior
17 │ var promises = require('fs/promises');
The package "fs/promises" wasn't found on the file system but is built into node.
Are you trying to bundle for node?
You can use "platform: 'node'" to do that, which will remove this error.
Build failed with 1 error:
node_modules/@remix-run/node/upload/fileUploadHandler.js:17:23: ERROR: Could not resolve "fs/promises"
Issue Analytics
- State:
- Created a year ago
- Reactions:13
- Comments:16 (1 by maintainers)
Top Results From Across the Web
Can't resolve 'fs/promises' · Issue #1612 - GitHub
running tsc compiles the files without any problem, but with webpack I got the error. Module not found: Error: Can't resolve 'fs/promises'.
Read more >Module not found: Error: Can't resolve 'fs' in - Stack Overflow
I found a possible solution, that you have to put some configuration in one of the node_modules. But I think that is not...
Read more >How to solve Cannot find module 'fs/promises'? - Medium
Recently, I need to install npm package name of rotating-file-stream. So, install it and start npm run… npm show error like below: Cannot...
Read more >Error in set up of "fs-extra" module - Plugins - Joplin Forum
and this one is throughing error something like this is coming on terminal - ERROR in ./dist/index.js Module not found: Error: Can't resolve...
Read more >How To Solve Module Not Found Can't Resolve 'fs' in Next.js
The Module not found: Can't resolve 'fs' error and similar issues most likely occur when you try to import a module that is...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Same issu for me, in my case this is due to importing anything (redirect, json) from
@remix-run/node
in a yarn PNP monorepo. I didn’t find a way around it but to usenew Response (...)
Thank you Tim, but we already use the new imports rather than the deprecated ones. We also don’t use
fs-extra
, so no clue where to start.One way to solve this would be to patch away the line failing the CI run with https://www.npmjs.com/package/patch-package I guess.