Skip to content

Commit

Permalink
fix npm ERR code ENOTCACHED
Browse files Browse the repository at this point in the history
caused by "latest" version in lockfile

fix: npm ERR! code ENOTCACHED
  request to https://registry.npmjs.org/... failed:
  cache mode is 'only-if-cached' but no cached response is available.

similar issue: nix-community#45
  • Loading branch information
milahu committed Aug 9, 2023
1 parent fe17301 commit 73318e4
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion internal-v2.nix
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,20 @@ rec {
# version.
# We already pinned everything through the "resolved", we can
# relax those.
patchDependencies = deps: lib.mapAttrs (_n: dep: if isGitHubRef dep || isGitHubRefWithoutRev dep then "*" else dep) deps;
patchDependencies = deps: lib.mapAttrs
(_n: dep:
if (
isGitHubRef dep ||
isGitHubRefWithoutRev dep ||
# fix: npm ERR! code ENOTCACHED
# request to https://registry.npmjs.org/... failed:
# cache mode is 'only-if-cached' but no cached response is available.
# similar issue: https://github.com/nix-community/npmlock2nix/issues/45
dep == "latest"
) then "*" else
dep
) deps;

patchedResolved =
if (!isGitHubRef spec.resolved)
then makeUrlSource sourceOptions name spec.version spec.resolved defaultedIntegrity
Expand Down

0 comments on commit 73318e4

Please sign in to comment.