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] Typescript 3.6.5 installation failure (cannot apply hunk) #1221

Closed
svvac opened this issue Apr 20, 2020 · 15 comments
Closed

[Bug] Typescript 3.6.5 installation failure (cannot apply hunk) #1221

svvac opened this issue Apr 20, 2020 · 15 comments
Labels
bug Something isn't working upholded Real issues without formal reproduction

Comments

@svvac
Copy link
Contributor

svvac commented Apr 20, 2020

Installing typescript 3.6.5 fails when applying compat patch.

➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed in 1.29s
➤ YN0000: ┌ Fetch step
➤ YN0013: │ typescript@patch:typescript@npm%3A3.6.5#builtin<compat/typescript>::version=3.6.5&hash=c79188 can't be found in the cache and will be fetched from the disk
➤ YN0001: │ Error: typescript@patch:typescript@npm%3A3.6.5#builtin<compat/typescript>::version=3.6.5&hash=c79188: Cannot apply hunk #5
    at c (/tmp/berry-test-ts3.6/.yarn/releases/yarn-berry.js:56:59007)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async /tmp/berry-test-ts3.6/.yarn/releases/yarn-berry.js:56:61149
    at async o (/tmp/berry-test-ts3.6/.yarn/releases/yarn-berry.js:56:58290)
    at async Object.t.applyPatchFile (/tmp/berry-test-ts3.6/.yarn/releases/yarn-berry.js:56:61122)
    at async t.PatchFetcher.patchPackage (/tmp/berry-test-ts3.6/.yarn/releases/yarn-berry.js:56:58045)
    at async /tmp/berry-test-ts3.6/.yarn/releases/yarn-berry.js:56:57194
    at async d (/tmp/berry-test-ts3.6/.yarn/releases/yarn-berry.js:42:91814)
    at async /tmp/berry-test-ts3.6/.yarn/releases/yarn-berry.js:42:92398
    at async /tmp/berry-test-ts3.6/.yarn/releases/yarn-berry.js:42:93503
➤ YN0000: └ Completed in 14.5s
➤ YN0000: Failed with errors in 15.79s

The same error occurs for the whole 3.6.x series. 3.5 installs correctly, so does 3.7.

Installing yarn from sources doesn't help.

For context, this happened while installing @angular-devkit/[email protected].

Reproduction:

$ mkdir repro
$ cd repro
$ yarn set version berry
$ yarn init
$ yarn add [email protected]

Env (linux)

$ yarn --version
2.0.0-rc.32
$ node --version
v12.16.1
@svvac svvac added the bug Something isn't working label Apr 20, 2020
@ndelangen
Copy link

Got something similar:

➤ YN0000: └ Completed in 1.46m
➤ YN0000: ┌ Fetch step
➤ YN0013: │ typescript@patch:typescript@npm%3A3.6.5#builtin<compat/typescript>::version=3.6.5&hash=c79188 can't be found in the cache and will be fetched from the disk
➤ YN0001: │ Error: typescript@patch:typescript@npm%3A3.6.5#builtin<compat/typescript>::version=3.6.5&hash=c79188: Cannot apply hunk #5
    at c (/Users/dev/Projects/GitHub/storybook/core/.yarn/releases/yarn-2.0.0-rc.32.js:56:59007)
    at process._tickCallback (internal/process/next_tick.js:68:7)
➤ YN0000: └ Completed in 11.19s
➤ YN0000: Failed with errors in 1.65m

@msakrejda
Copy link

Thanks, also ran into this. 3.8 seems to work.

gaetanmaisse added a commit to storybookjs/storybook that referenced this issue Apr 26, 2020
…all issue

When Yarn 2 is trying to install and patch TS 3.6 it throws:
➤ YN0013: │ typescript@patch:typescript@npm%3A3.6.5#builtin<compat/typescript>::version=3.6.5&hash=c79188 can't be found in the cache and will be fetched from the disk
➤ YN0001: │ Error: typescript@patch:typescript@npm%3A3.6.5#builtin<compat/typescript>::version=3.6.5&hash=c79188: Cannot apply hunk #5

This is a Yarn 2 related issue, tracked here: yarnpkg/berry#1221
@yarnbot

This comment has been minimized.

@yarnbot yarnbot added the stale Issues that didn't get attention label Jun 9, 2020
@paul-soporan paul-soporan added upholded Real issues without formal reproduction and removed stale Issues that didn't get attention labels Jun 9, 2020
@sushruth
Copy link

I was able to go around this issue by pinning down typescript resolutions in package.json

{
  // ...
  "resolutions": {
     "typescript": "3.9.5"
  }
}

May not work for all but should work for most.

@ozyman42
Copy link

ozyman42 commented Jun 22, 2020

Looks like typescript 3.9.5 works for me... sometimes.
In one of my projects it works, I see

typescript@patch:typescript@npm%3A3.9.5#builtin<compat/typescript>::version=3.9.5&hash=8cac75

In a different project yarn install is failing with message

typescript@patch:typescript@npm%3A3.9.5#builtin<compat/typescript>::version=3.9.5&hash=270b6c: Cannot apply hunk #6

I don't know why a different hash is being used for the same typescript major minor patch semver even after I clear the cache and remove the lockfile for both projects. Weird.

@merceyz
Copy link
Member

merceyz commented Jun 22, 2020

Do you have the same yarn version in both projects? Yarn patches typescript to add support for PnP.

@jamie-pate
Copy link

jamie-pate commented Jun 22, 2020

trying to install
"@angular-devkit/build-angular": "~0.901.4",
causes this because it depends on 3.6.5, there's no resolution that will work because 3.6.5 is the final 3.6 version.. how does something like this sneak in? this patch system seems flawed.... I'm not even using PnP

@ozyman42
Copy link

ozyman42 commented Jun 23, 2020

Do you have the same yarn version in both projects? Yarn patches typescript to add support for PnP.

I hadn't thought about checking. Looks like the Cannot apply hunk #6 was when I was using yarn 2.0.0-rc.31, however the projects which were not failing used more recent versions.

Upgraded yarn via yarn set version latest and then install worked fine w/ typescript 3.9.5.

@psydvl
Copy link

psydvl commented Jul 7, 2020

node v10.21.0 & v11.15.0

➤ YN0001: │ Error: typescript@patch:typescript@npm%3A3.6.5#builtin<compat/typescript>::version=3.6.5&hash=64df9d: Cannot apply hunk #6
     at C (/home/nixi/work/support/.yarn/releases/yarn-2.0.0-rc.36.cjs:77:103081)

node v12.18.2 & v13.14.0 & v14.5.0

➤ YN0001: │ Error: typescript@patch:typescript@npm%3A3.6.5#builtin<compat/typescript>::version=3.6.5&hash=64df9d: Cannot apply hunk #6
    at C (/home/nixi/work/support/.yarn/releases/yarn-2.0.0-rc.36.cjs:77:103081)
    at async /home/nixi/work/support/.yarn/releases/yarn-2.0.0-rc.36.cjs:77:102344
    at async g (/home/nixi/work/support/.yarn/releases/yarn-2.0.0-rc.36.cjs:77:100986)
    at async f (/home/nixi/work/support/.yarn/releases/yarn-2.0.0-rc.36.cjs:77:102317)
    at async ne.fetchers.patchPackage (/home/nixi/work/support/.yarn/releases/yarn-2.0.0-rc.36.cjs:77:118194)
    at async w (/home/nixi/work/support/.yarn/releases/yarn-2.0.0-rc.36.cjs:37:45769)
    at async B (/home/nixi/work/support/.yarn/releases/yarn-2.0.0-rc.36.cjs:37:46239)
    at async Q (/home/nixi/work/support/.yarn/releases/yarn-2.0.0-rc.36.cjs:37:46715)
    at async C.fetchPackageFromCache (/home/nixi/work/support/.yarn/releases/yarn-2.0.0-rc.36.cjs:37:46954)
    at async ne.fetchers.fetch (/home/nixi/work/support/.yarn/releases/yarn-2.0.0-rc.36.cjs:77:117113)

@arcanis
Copy link
Member

arcanis commented Jul 8, 2020

This should now be fixed in master. Note that the integration is slightly less good in 3.6 than 3.9+, so if you depend on TS yourself, we still suggest to upgrade.

@arcanis arcanis closed this as completed Jul 8, 2020
@harrysolovay
Copy link

Still an issue.

@arcanis
Copy link
Member

arcanis commented Sep 28, 2020

4.1.0 is still in beta, and any support for it is best effort. It literally just got merged in the trunk, so you'll have to use the master branch to install it.

@harrysolovay
Copy link

Thank you @arcanis !!!

@the21st
Copy link

the21st commented Dec 2, 2020

Hey! Any updates on typescript 4.1 support? It's been out for 2 weeks now.

@arcanis
Copy link
Member

arcanis commented Dec 2, 2020

The fix has been released last Monday, in 2.4

@yarnpkg yarnpkg locked as resolved and limited conversation to collaborators Dec 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working upholded Real issues without formal reproduction
Projects
None yet
Development

No branches or pull requests