[Bug?]: `fs/promises` is detected as a dependency
See original GitHub issueSelf-service
- I’d be willing to implement a fix
Describe the bug
Any package which uses fs/promises is unable to import as yarn asks this to be listed in it’s dependencies.
Error: builder-util tried to access fs, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: fs (via "fs/promises")
To reproduce
await packageJsonAndInstall({});
await expect(node(`require.resolve('fs/promises')`)).resolves.toBeTruthy();
You can also go into any repo running yarn@3, make a file with require('fs/promises') and run yarn node file.js
Error: Your application tried to access fs, but it isn't declared in your dependencies; this makes the require call ambiguous and unsound.
Required package: fs (via "fs/promises")
Environment
System: OS: Linux 4.15 Ubuntu 16.04.7 LTS (Xenial Xerus) CPU: (6) x64 AMD FX™-6100 Six-Core Processor Binaries: Node: 12.22.5 - /tmp/xfs-38ba3067/node Yarn: 3.0.1 - /tmp/xfs-38ba3067/yarn npm: 6.14.14 - ~/.nvm/versions/node/v12.22.5/bin/npm
Additional context
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
node.js - fs/promises api in typescript not compiling in ...
I was recently working with typescript and fs/promises API and got this error when the typescript code was compiled and run, ...
Read more >CJS loader error caught in PnP is different from expected ...
The issue manifests itself for external "type": "module" dependencies, e.g. node-fetch . For workspace dependencies the error is the same as ...
Read more >Dependency injection | LoopBack Documentation
LoopBack can detect circular dependencies and report the path which leads to the problem. Consider the following example: import {Context, inject} from ...
Read more >Changelog
Installing a dependency with the same name as the root project no longer requires --force . (That is, the ENOSELF error is removed.)...
Read more >Node.js v19.3.0 Documentation
appendFile(path, data[, options]); fsPromises.chmod(path, mode) ... Error behavior; Integrity checks; Dependency redirection; Example: Patched dependency.
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

Node 12.22.5 doesn’t report
fs/promisesas a builtin moduleYou were missing an install and a
expectto assert what should happen, I’ve updated your repro but it wont reproduce as it runs with Node 14 which does report it as a builtin moduleWe couldn’t reproduce your issue (all the assertions passed on master).