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] Can't install TypeScript 4.3.2 #2944

Closed
selfagency opened this issue May 28, 2021 · 1 comment
Closed

[Bug] Can't install TypeScript 4.3.2 #2944

selfagency opened this issue May 28, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@selfagency
Copy link

Describe the bug

An error is thrown when attempting to install TypeScript. This same issue appears to have arisen previously. See #1221.

typescript@patch:typescript@npm%3A4.3.2#builtin<compat/typescript>::version=4.3.2&hash=a45b0e: Cannot apply hunk #2 (set enableInlineHunks for details)

To Reproduce

yarn init -y
yarn set version berry
yarn add typescript --dev

Screenshots

02:05:32 ➜ yarn add typescript --dev
➤ YN0000: ┌ Resolution step
➤ YN0000: └ Completed
➤ YN0000: ┌ Fetch step
➤ YN0013: │ typescript@npm:4.3.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ typescript@patch:typescript@npm%3A4.3.2#builtin<compat/typescript>::version=4.3.2&hash=a45b0e can't be found in the cache and will be fetched from the disk
➤ YN0013: │ typescript@npm:4.3.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0066: │ typescript@patch:typescript@npm%3A4.3.2#builtin<compat/typescript>::version=4.3.2&hash=a45b0e: Cannot apply hunk #2 (set enableInlineHunks for details)
➤ YN0000: └ Completed in 0s 602ms
➤ YN0000: Failed with errors in 0s 772ms
02:02:36 ✖1 ➜ yarn
➤ YN0000: ┌ Resolution step
➤ YN0061: │ chokidar@npm:1.7.0 is deprecated: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
➤ YN0061: │ core-js@npm:2.6.12 is deprecated: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
➤ YN0061: │ fsevents@npm:1.2.13 is deprecated: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged
➤ YN0061: │ fsevents@npm:1.2.13 is deprecated: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
➤ YN0032: │ nan@npm:2.14.2: Implicit dependencies on node-gyp are discouraged
➤ YN0061: │ resolve-url@npm:0.2.1 is deprecated: https://github.com/lydell/resolve-url#deprecated
➤ YN0061: │ urix@npm:0.1.0 is deprecated: Please see https://github.com/lydell/urix#deprecated
➤ YN0002: │ typescript@workspace:. doesn't provide prettier (p4351c), requested by eslint-plugin-prettier
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements <hash> for details, where <hash> is the six-letter p-prefixed code
➤ YN0000: └ Completed in 7s 781ms
➤ YN0000: ┌ Fetch step
➤ YN0013: │ yallist@npm:4.0.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs-parser@npm:20.2.7 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yargs@npm:16.2.0 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ yn@npm:3.1.1 can't be found in the cache and will be fetched from the remote registry
➤ YN0013: │ typescript@npm:4.3.2 can't be found in the cache and will be fetched from the remote registry
➤ YN0066: │ typescript@patch:typescript@npm%3A4.3.2#builtin<compat/typescript>::version=4.3.2&hash=a45b0e: Cannot apply hunk #2
➤ YN0000: │           }
➤ YN0000: │       }
➤ YN0000: │       ts.getEffectiveTypeRoots = getEffectiveTypeRoots;
➤ YN0028: │ -     function getDefaultTypeRoots(currentDirectory, host) {
➤ YN0028: │ +     function getNodeModulesTypeRoots(currentDirectory, host) {
➤ YN0000: │           if (!host.directoryExists) {
➤ YN0000: │               return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)];
➤ YN0000: │           }
➤ YN0028: │ -         var typeRoots;
➤ YN0028: │ +         var typeRoots = [];
➤ YN0000: │           ts.forEachAncestorDirectory(ts.normalizePath(currentDirectory), function (directory) {
➤ YN0000: │               var atTypes = ts.combinePaths(directory, nodeModulesAtTypes);
➤ YN0000: │               if (host.directoryExists(atTypes)) {
➤ YN0028: │ -                 (typeRoots || (typeRoots = [])).push(atTypes);
➤ YN0028: │ +                 typeRoots.push(atTypes);
➤ YN0000: │               }
➤ YN0000: │               return undefined;
➤ YN0000: │           });
➤ YN0000: │           return typeRoots;
➤ YN0000: │       }
➤ YN0000: │       var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types");
➤ YN0028: │ +     function getPnpTypeRoots(currentDirectory) {
➤ YN0028: │ +         if (!isPnpAvailable()) {
➤ YN0028: │ +             return [];
➤ YN0028: │ +         }
➤ YN0028: │ +         currentDirectory = ts.sys.resolvePath(currentDirectory);
➤ YN0028: │ +         var pnpapi = getPnpApi();
➤ YN0028: │ +         var currentPackage = pnpapi.findPackageLocator(currentDirectory + "/");
➤ YN0028: │ +         if (!currentPackage) {
➤ YN0028: │ +             return [];
➤ YN0028: │ +         }
➤ YN0028: │ +         var packageDependencies = pnpapi.getPackageInformation(currentPackage).packageDependencies;
➤ YN0028: │ +         var typeRoots = [];
➤ YN0028: │ +         for (var _i = 0, _a = Array.from(packageDependencies.entries()); _i < _a.length; _i++) {
➤ YN0028: │ +             var _b = _a[_i], name = _b[0], referencish = _b[1];
➤ YN0028: │ +             if (name.startsWith(typesPackagePrefix) && referencish !== null) {
➤ YN0028: │ +                 var dependencyLocator = pnpapi.getLocator(name, referencish);
➤ YN0028: │ +                 var packageLocation = pnpapi.getPackageInformation(dependencyLocator).packageLocation;
➤ YN0028: │ +                 typeRoots.push(ts.getDirectoryPath(packageLocation));
➤ YN0028: │ +             }
➤ YN0028: │ +         }
➤ YN0028: │ +         return typeRoots;
➤ YN0028: │ +     }
➤ YN0028: │ +     var typesPackagePrefix = "@types/";
➤ YN0028: │ +     function getDefaultTypeRoots(currentDirectory, host) {
➤ YN0028: │ +         var nmTypes = getNodeModulesTypeRoots(currentDirectory, host);
➤ YN0028: │ +         var pnpTypes = getPnpTypeRoots(currentDirectory);
➤ YN0028: │ +         if (nmTypes.length > 0 || pnpTypes.length > 0) {
➤ YN0028: │ +             return __spreadArray(__spreadArray([], nmTypes), pnpTypes);
➤ YN0028: │ +         }
➤ YN0028: │ +     }
➤ YN0000: │       function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host, redirectedReference) {
➤ YN0000: │           var traceEnabled = isTraceEnabled(options, host);
➤ YN0000: │           if (redirectedReference) {
➤ YN0000: └ Completed in 11s 593ms
➤ YN0000: Failed with errors in 19s 380ms

Environment if relevant (please complete the following information):

  • OS: MacOS 11.4
  • Node version 14.17.0
  • Yarn version 2.4.1
@selfagency selfagency added the bug Something isn't working label May 28, 2021
@merceyz
Copy link
Member

merceyz commented May 28, 2021

Duplicate of #2938

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