-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] fs functions that use buffer encoding fail #1818
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
We couldn't reproduce your issue (all the assertions passed on master). |
I'm running into this issue when trying to build a project using rollup with node 17.6.0 and yarn berry v3.2.0. Any updates? |
rantMy minimum reproducible repo would include `serverless` and `serverless-esbuild` which is sub-optimal, it can be easily dodged by maintainers so I am not providing it here. And I don't bother learning yarn internals enough to pin point the exact place where it does codegen for `.pnp.cjs`. Nobody else can do this as efficiently as current contributors.Here is a patch instead. moar rantCouldn't resist and finally took a look. Now that I'm in the rabbit hole, it's I just don't know how tf an unexpected buffer input and an expected string input is simply expressed as Come on, guys. WorkaroundApply the following patch in your @@ -32543,10 +32543,11 @@ class VirtualFS extends ProxiedFS {
mapToBase(p) {
+ const pathString = `${p}`;
if (pathString === ``)
return p;
- if (this.pathUtils.isAbsolute(p))
- return VirtualFS.resolveVirtual(p);
+ if (this.pathUtils.isAbsolute(pathString))
+ return VirtualFS.resolveVirtual(pathString);
const resolvedRoot = VirtualFS.resolveVirtual(this.baseFs.resolve(PortablePath.dot));
- const resolvedP = VirtualFS.resolveVirtual(this.baseFs.resolve(p));
+ const resolvedP = VirtualFS.resolveVirtual(this.baseFs.resolve(pathString));
return ppath.relative(resolvedRoot, resolvedP) || PortablePath.dot;
}
mapFromBase(p) { I expect the file to be re-generated every time after running yarn add/remove, the exact lines to be patched should change. This is a very temporary solution and this issue requires actual fix to PR hintsFor those who care enough to go for a PR, you may start here.
berry/packages/yarnpkg-fslib/sources/path.ts Lines 9 to 10 in 5542570
|
I just encountered this issue when doing
|
This comment was marked as duplicate.
This comment was marked as duplicate.
@trollkotze I encountered the same issue as you. Yarn version:
|
Still reproducible with the latest yarn 4.0.0-rc.6 from sources and node 18.2.0:
Using the workaround from @vicary, as above, in the meantime (many thanks!) Not sure why this issue is labelled as |
This issue likely causes this strange bug vitejs/vite#8897 on node 18> in vite |
Also have the same issue as @IgnusG with Nx where every other (uncached) Environment:
My workaround is to revert to Node 16.16.0, which doesn't trigger the same errors, since editing `yarn nx reset` Log
`yarn nx build backend` Log
`yarn nx serve backend` Log
|
I forked version 3.2.1 with @vicary's patch that persists the change to Yarn runs from a compiled release, so the patch has to be compiled into the release. You can do this by running:
Happy to create a PR for this, but unsure if this is the best way to fix the bug. If one of the maintainers wants to provide some feedback or direction on this issue I can work on something more permanent. |
I'm still having this issue on the latest yarn 3.2.4 on nodejs 19.0.0 using PnP. @vicary's change fixed it but it does require editing .pnp.cjs. I'm running |
This fix isn't in v3.2.4, it hasn't been released in a stable version yet. We'll make a new stable release with the fix soon but until then you can use a canary build
or build it from source
|
Perfect, thanks @merceyz! ❤️ Works well on canary I was looking for release information on the PR but couldn't find any. |
Describe the bug
Yarn
fs
reimplementation assumes fs functions only accept strings as input, instead they could beBuffer
orURL
for exampleThe error you get is
To Reproduce
Reproduction
// Sherlock reproduction
Screenshots
If applicable, add screenshots to help explain your problem.
Environment if relevant (please complete the following information):
Additional context
#899 is a similar problem
node-dir
npm package (2 million monthly downloads)files
function fails because of thisThe text was updated successfully, but these errors were encountered: