-
-
Notifications
You must be signed in to change notification settings - Fork 42
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
ENOTCACHED / cache mode is 'only-if-cached' but no cached response available #45
Comments
I think is might be related with the other projects but neither of their solutions are likey to work here. Can you pust the relevant parts of your package.json and package-lock.json? My guess is that it is just another variant of the git references. I've multiple branches that add better/different support of them but all of them require massive cleanup. |
You can reproduce this with the Sapper template: I used a vanilla npmlock2nix { pkgs ? import <nixpkgs> {}, npmlock2nix ? import <npmlock2nix> { inherit pkgs; } }:
npmlock2nix.shell {
src = ./.;
nodejs = pkgs.nodejs-14_x;
} Based on the error message in the post above, it seems that polka is the culprit. |
Any ideas about even a hacky/temporary workaround for this? I currently cannot use npmlock2nix for my project anymore due to this issue... |
This issue is unfortunately fairly common, in my brief experience so far with |
On that note, I'm not sure whether this is the same issue or not, but if you try to set up Tailwind CSS for use with a
Unfortunately, I don't know how to work around this, as |
I ran into the same error on my project, it seems to be a dependency that was pulled out of npm. unfortunately I got the same error with another dependency after that. |
I may have gained some insight into the internals of this, but not much. Nag me to take some notes at some point. Here's some log from where we got with peeking at the above mentioned issue today, but it doesn't seem to be the same as a related looking issue we've been fighting;
This log is using a lock file generated by npm 6 so that npmlock2nix can handle it, and then we use npm 7 because the output seems easier to make sense of and use in debugging. |
FYI, I have yet to encounter this with https://github.com/serokell/nix-npm-buildpackage (edit not with |
Unfortunately, I have encountered this issue with nix-npm-buildpackage, at least using NPM v7. Under the thread for serokell/nix-npm-buildpackage#33, @yorickvP linked npm/cli#2160, which seems to point to a fix for pacote being pushed with npm/pacote@500a34f. Based on the versions associated with nodejs/npm, this fix should be available as part of pacote 11.3.2 / nodejs 7.11.0 if I understand correctly. Still totally lost with where that leaves us with all these projects, as they seem to be mostly up to date as far as |
Yes, I have as well with |
Hi! When I looked into it, I think my conclusion was that |
good news : ) should be fixed in #93 (comment) |
I tried your branch here: milahu@3970a1b I don't get
The project works with |
maybe thats too silent. can you test d0c89d1? |
Sorry, no luck — back to
|
can you share your package.json and package-lock.json files? |
Not for that particular project, but here's the one it's based on, where I first encountered this issue. With milahu@3970a1b (and But once you try to add Tailwind & its dependencies, it breaks with the same error that I showed above: https://github.com/hackworthltd/react-nix-craco-public/commit/e4dd29ae364d0625c81ee0abfc61e96397bd7e56 |
This comment has been minimized.
This comment has been minimized.
Hmm, are you sure that's a good solution? @andir and I discovered that Nix store paths were being written into the |
no ... the problem started with "tailwindcss": "npm:@tailwindcss/postcss7-compat@^2.2.9", "tailwindcss": {
"version": "npm:@tailwindcss/postcss7-compat@2.2.9",
"resolved": "https://registry.npmjs.org/@tailwindcss/postcss7-compat/-/postcss7-compat-2.2.9.tgz", in the patched lockfile "tailwindcss": {
"resolved": "file:///nix/store/zcggqgvhw919c209c7f4hpfq3ki6a1bw-postcss7-compat-2.2.9.tgz",
"version": "@tailwindcss/postcss7-compat@2.2.9"
}, the patched version should be echo patch lockfile for debug
#sed -i 's|"@tailwindcss/postcss7-compat@^2.2.9"|"npm:@tailwindcss/postcss7-compat@2.2.9"|' package.json
#sed -i 's|"version":"@tailwindcss/postcss7-compat@2.2.9"|"version":"npm:@tailwindcss/postcss7-compat@2.2.9"|' package-lock.json
#npm verb stack Error: request to https://registry.npmjs.org/@tailwindcss%2fpostcss7-compat failed: cache mode is 'only-if-cached' but no cached response available.
sed -i 's|"@tailwindcss/postcss7-compat@^2.2.9"|"2.2.9"|' package.json
sed -i 's|"version":"@tailwindcss/postcss7-compat@2.2.9"|"version":"2.2.9"|' package-lock.json
# works
echo "use npm version $(npm --version) in $(${which}/bin/which npm)"
# use npm version 6.14.14 in /nix/store/pvnvfvimzldwbx08pj53iaf3z1wmwl94-nodejs-14.17.5/bin/npm
echo "run 'npm install' ..."
npm install --offline --nodedir=${nodeSource nodejs} --progress=false # --loglevel=verbose
the patched json files are only used in npmlock2nix |
The Tailwind version string comes straight from the documentation here: https://tailwindcss.com/docs/guides/create-react-app It works fine with |
please try 47e3003 with "patching dependencies" i mean the function |
Closer, but still no cigar. It works fine with https://github.com/hackworthltd/react-nix-craco-public/commit/aff06f32d4befcca2a633c95a4295fec1f332d82 However, with the more complicated (private) repo I tested yesterday, it fails with this log: https://gist.github.com/dhess/084878f17db5859c0bf70f251e235731 (Edit I recreated the (Edit #2 Exactly the same problem with |
probably another bug in npmlock2nix
-> why is version 8.1.0 not installed deep in possible reason: a github version to debug, add this to
in the first then compare with your input files
|
I guess there's no real harm in making the
|
could be a bug in npm 6 patched lockfile, as produced by npmlock2nix{
"dependencies": {
"react-scripts": {
"version": "4.0.3",
"resolved": "file:///nix/store/jfkjd4w2nfzwa93q97h4db6r47m06b3a-react-scripts-4.0.3.tgz",
"dependencies": {
"babel-loader": {
"version": "8.1.0",
"resolved": "file:///nix/store/873g019wn2x550f4sdssjdl7nlgy9n3g-babel-loader-8.1.0.tgz"
},
},
"requires": {
"babel-loader": "8.1.0"
}
}
}
} workaround in npmlock2nix: in thats how i fixed the ENOTCACHED bug with my github dependencies |
Thanks for your hard work on this! I think I'll continue using |
weird, with nix-npm-buildpackage i also get the warning from react-scripts this warning "should" be fixed by i say "should" cos "dear npm, are my commands a joke to you?" ... your case with "flat" node_modules= deduplication on, note the "deduped" annotations
"global" version of babel-loader, shared by
"local" version of babel-loader, only for
maybe this can be solved with |
create a package dir at top level of tarball from Github to fix bug where npm install cannot resolve dependencies. This fix resolves ENOTCACHED errors in the preinstall phase caused by improperly structured tarballs. Tarballs that npm can use, package contents should reside in a subfolder inside the tarball (usually it is called package/). npm strips one directory layer when installing the package (an equivalent of tar x --strip-components=1 is run). See https://docs.npmjs.com/cli/v7/commands/npm-install This relates to issue nix-community#45.
create a package dir at top level of tarball from Github to fix bug where npm install cannot resolve dependencies. This fix resolves ENOTCACHED errors in the preinstall phase caused by improperly structured tarballs. Tarballs that npm can use, package contents should reside in a subfolder inside the tarball (usually it is called package/). npm strips one directory layer when installing the package (an equivalent of tar x --strip-components=1 is run). See https://docs.npmjs.com/cli/v7/commands/npm-install This relates to issue nix-community#45.
I'm getting this issue with the |
I'm also getting the issue while trying to install |
Yup, running into this due to |
9/10 times it's related to package locks that are missing hashes. This is especially prevalent in older versions of |
Thanks! My work-around was using |
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/npmlock2nix#45
Happened with me: npm.v1.node_modules { src = inputs.simplecrypto; } + /node_modules;
|
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
any updates on this? still actual in 2024 on 24.05 |
I'm not sure this isn't related to npmlock2nix, but now that my build works I get this:
Is it possible that this is related to svanderburg/node2nix#106 (and also svanderburg/node2nix#70) and that this is because of bundled
package-lock.json
files in some packages in the dependency tree?If this is so, I guess npmlock2nix needs to do something like svanderburg/node2nix#106 (comment)
The text was updated successfully, but these errors were encountered: