ds300 / patch-package

Fix broken node modules instantly 🏃🏽‍♀️💨
MIT License
10.14k stars 283 forks source link

Can't patch package postcss-rename #468

Open RodrigoTomeES opened 1 year ago

RodrigoTomeES commented 1 year ago

When trying to patch this package it gives an error


yarn patch-package postcss-rename

patch-package 7.0.0
• Creating temporary folder
• Installing postcss-rename@0.6.1 with yarn

error {
  status: 1,
  signal: null,
  output: [
    null,
    <Buffer 1b 5b 33 31 6d 1b 5b 31 6d 55 6e 6b 6e 6f 77 6e 20 53 79 6e 74 61 78 20 45 72 72 6f 72 1b 5b 32 32 6d 1b 5b 33 39 6d 3a 20 55 6e 73 75 70 70 6f 72 74 ... 142 more bytes>,
    <Buffer >
  ],
  pid: 16884,
  stdout: <Buffer 1b 5b 33 31 6d 1b 5b 31 6d 55 6e 6b 6e 6f 77 6e 20 53 79 6e 74 61 78 20 45 72 72 6f 72 1b 5b 32 32 6d 1b 5b 33 39 6d 3a 20 55 6e 73 75 70 70 6f 72 74 ... 142 more bytes>,
  stderr: <Buffer >,
  error: null
}

E:\\node_modules\patch-package\dist\makePatch.js:218
        throw e;
        ^
{
  status: 1,
  signal: null,
  output: [
    null,
    Buffer(192) [Uint8Array] [
       27,  91,  51,  49, 109,  27,  91,  49, 109,  85, 110, 107,
      110, 111, 119, 110,  32,  83, 121, 110, 116,  97, 120,  32,
       69, 114, 114, 111, 114,  27,  91,  50,  50, 109,  27,  91,
       51,  57, 109,  58,  32,  85, 110, 115, 117, 112, 112, 111,
      114, 116, 101, 100,  32, 111, 112, 116, 105, 111, 110,  32,
      110,  97, 109, 101,  32,  40,  34,  45,  45, 105, 103, 110,
      111, 114, 101,  45, 115,  99, 114, 105, 112, 116, 115,  34,
       41,  46,  10,  10,  36,  32, 121,  97, 114, 110,  32, 105,
      110, 115, 116,  97,
      ... 92 more items
    ],
    Buffer(0) [Uint8Array] []
  ],
  pid: 16884,
  stdout: Buffer(192) [Uint8Array] [
     27,  91,  51,  49, 109,  27,  91,  49, 109,  85, 110, 107,
    110, 111, 119, 110,  32,  83, 121, 110, 116,  97, 120,  32,
     69, 114, 114, 111, 114,  27,  91,  50,  50, 109,  27,  91,
     51,  57, 109,  58,  32,  85, 110, 115, 117, 112, 112, 111,
    114, 116, 101, 100,  32, 111, 112, 116, 105, 111, 110,  32,
    110,  97, 109, 101,  32,  40,  34,  45,  45, 105, 103, 110,
    111, 114, 101,  45, 115,  99, 114, 105, 112, 116, 115,  34,
     41,  46,  10,  10,  36,  32, 121,  97, 114, 110,  32, 105,
    110, 115, 116,  97,
    ... 92 more items
  ],
  stderr: Buffer(0) [Uint8Array] [],
  error: null
}

Node.js v18.16.0
hazzo commented 1 year ago

It seems to be an issue with the node version. With Node 16 did not have the problem.

RodrigoTomeES commented 1 year ago

I also tried it in node 19 and it also throw the error, maybe is it broken for node > v16?

georgeflug commented 1 year ago

I am having this problem too while patching anything in a yarn project. I see the same output buffer hex:

<Buffer 1b 5b 33 31 6d 1b 5b 31 6d 55 6e 6b 6e 6f 77 6e 20 53 79 6e 74 61 78 20 45 72 72 6f 72 1b 5b 32 32 6d 1b 5b 33 39 6d 3a 20 55 6e 73 75 70 70 6f 72 74 ... 142 more bytes>,

Stepping through the patch-package code I was able to get the whole error when it tries to spawn yarn install --ignore-engines --ignore-scripts:

Syntax Error: Unsupported option name ("--ignore-scripts").

$ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]

I'm also seeing the error below when it does yarn install --ignore-engines:

�� YN0050: The --ignore-engines option is deprecated; engine checking isn't a core feature anymore

I am on Node v16.19.1 and yarn 3.3.0 (although it uses yarn 3.4.1 in the temp folder that is created)

Edit: In my case I got it working by downgrading my globally installed yarn from 3.4.1 to 1.22.19