Skip to content
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.rmSync error with yarn PnP: The "path" argument must be of type string. Received an instance of Buffer #3903

Closed
1 task
gutenye opened this issue Dec 23, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@gutenye
Copy link

gutenye commented Dec 23, 2021

Self-service

  • I'd be willing to implement a fix

Describe the bug

fs.rmSync does not work with yarn PnP

To reproduce

mkdir hello && cd hello
yarn init -2
yarn
mkdir -p a/b/c/d/e/f/g
vi a.js
  const fs = require('fs')
  fs.rmSync('./a', { recursive: true })
yarn node a.js

Got

node:internal/fs/rimraf:202
      throw err;
      ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Buffer
    at new NodeError (node:internal/errors:371:5)
    at validateString (node:internal/validators:120:11)
    at Object.isAbsolute (node:path:1157:5)
    at VirtualFS.mapToBase (/private/tmp/a/.pnp.cjs:6104:24)
    at VirtualFS.rmdirSync (/private/tmp/a/.pnp.cjs:5936:39)
    at PosixFS.rmdirSync (/private/tmp/a/.pnp.cjs:5936:24)
    at URLFS.rmdirSync (/private/tmp/a/.pnp.cjs:5936:24)
    at _rmdirSync (node:internal/fs/rimraf:260:21)
    at rimrafSync (node:internal/fs/rimraf:193:7)
    at node:internal/fs/rimraf:253:9 {
  code: 'ERR_INVALID_ARG_TYPE'
}

Environment

System:
    OS: macOS 12.1
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 17.3.0 - /private/var/folders/lv/6_bkp55j2sg6m4j20nz53v1c0000gn/T/xfs-d93da319/node
    Yarn: 3.1.1 - /private/var/folders/lv/6_bkp55j2sg6m4j20nz53v1c0000gn/T/xfs-d93da319/yarn
    npm: 8.3.0 - /opt/homebrew/bin/npm

Additional context

rmSync is not in

const SYNC_IMPLEMENTATIONS = new Set([

@gutenye gutenye added the bug Something isn't working label Dec 23, 2021
@merceyz
Copy link
Member

merceyz commented Jan 20, 2022

Duplicate of #1818

@merceyz merceyz marked this as a duplicate of #1818 Jan 20, 2022
@merceyz merceyz closed this as completed Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants