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

fetchYarnDeps: Can not find versions shadowed by derivations #184965

Open
3nprob opened this issue Aug 3, 2022 · 5 comments
Open

fetchYarnDeps: Can not find versions shadowed by derivations #184965

3nprob opened this issue Aug 3, 2022 · 5 comments
Labels
0.kind: bug Something is broken

Comments

@3nprob
Copy link

3nprob commented Aug 3, 2022

Describe the bug

Current NixOS version of element-desktop (1.11.0) builds fine.

It's using fetchYarnDeps for bundling the electron app.

Trying to build 1.11.1, which contains, this change, fails with this error:

yarn install v1.22.18
[1/4] Resolving packages...
yarn install v1.22.18
warning Lockfile has incorrect entry for "@types/node@^17.0.12". Ignoring it.
[1/4] Resolving packages...
warning Lockfile has incorrect entry for "@types/[email protected]". Ignoring it.
error Couldn't find any versions for "electron-store" that matches "^6.0.1" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Error: Couldn't find any versions for "@types/node" that matches "^17.0.12" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.
    at MessageError.ExtendableBuiltin (/nix/store/ciim9vng9jrwrbx2r3wmqss0x1c15i34-yarn-1.22.18/libexec/yarn/lib/cli.js:721:66)
    at new MessageError (/nix/store/ciim9vng9jrwrbx2r3wmqss0x1c15i34-yarn-1.22.18/libexec/yarn/lib/cli.js:750:123)
    at NpmResolver.<anonymous> (/nix/store/ciim9vng9jrwrbx2r3wmqss0x1c15i34-yarn-1.22.18/libexec/yarn/lib/cli.js:50430:15)
    at Generator.next (<anonymous>)
    at step (/nix/store/ciim9vng9jrwrbx2r3wmqss0x1c15i34-yarn-1.22.18/libexec/yarn/lib/cli.js:310:30)
    at /nix/store/ciim9vng9jrwrbx2r3wmqss0x1c15i34-yarn-1.22.18/libexec/yarn/lib/cli.js:321:13
Error: Couldn't find any versions for "@types/node" that matches "16.9.1" in our cache (possible versions are ""). This is usually caused by a missing entry in the lockfile, running Yarn without the --offline flag may help fix this issue.
    at MessageError.ExtendableBuiltin (/nix/store/ciim9vng9jrwrbx2r3wmqss0x1c15i34-yarn-1.22.18/libexec/yarn/lib/cli.js:721:66)
    at new MessageError (/nix/store/ciim9vng9jrwrbx2r3wmqss0x1c15i34-yarn-1.22.18/libexec/yarn/lib/cli.js:750:123)
    at NpmResolver.<anonymous> (/nix/store/ciim9vng9jrwrbx2r3wmqss0x1c15i34-yarn-1.22.18/libexec/yarn/lib/cli.js:50430:15)
    at Generator.next (<anonymous>)
    at step (/nix/store/ciim9vng9jrwrbx2r3wmqss0x1c15i34-yarn-1.22.18/libexec/yarn/lib/cli.js:310:30)
    at /nix/store/ciim9vng9jrwrbx2r3wmqss0x1c15i34-yarn-1.22.18/libexec/yarn/lib/cli.js:321:13

This is from current 22.05 release branch, so should have 9801e6e already.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Attempt to build element-desktop but bumping the version to 1.11.1, also updating the package.json and pin.json.

Notify maintainers

@yu-re-ka @purefn @sumnerevans

@3nprob 3nprob added the 0.kind: bug Something is broken label Aug 3, 2022
@sumnerevans
Copy link
Contributor

@Ma27 do you have any ideas on this one?

@yu-re-ka
Copy link
Contributor

mkYarnPackage / mkYarnModules does weird things with its "workspace" "feature". It doesn't actually run yarn install inside the source directory with the original package.json, but creates a fake package.json and this package.json is missing the resolutions field.

This can be worked around by setting packageResolutions so that the fake package.json also contains the same resolution:

diff --git a/pkgs/applications/networking/instant-messengers/element/element-desktop.nix b/pkgs/applications/networking/instant-messengers/element/element-desktop.nix
index 5b7c23f7c7a..a2b5b7f788b 100644
--- a/pkgs/applications/networking/instant-messengers/element/element-desktop.nix
+++ b/pkgs/applications/networking/instant-messengers/element/element-desktop.nix
@@ -38,6 +38,9 @@ mkYarnPackage rec {
     yarnLock = src + "/yarn.lock";
     sha256 = pinData.desktopYarnHash;
   };
+  packageResolutions = {
+    "@types/node" = "16.11.38";
+  };
 
   nativeBuildInputs = [ makeWrapper ] ++ lib.optionals stdenv.isDarwin [ desktopToDarwinBundle ];
 

Another workaround could be to not use mkYarnPackage, but run yarn manually inside a derivation like gitlab-assets does.

@sumnerevans
Copy link
Contributor

That got me further, but now I get:

20% building 24/76 modules 52 active /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/babel-loader/lib/index.js??ref--5!/build/source/src/vector/platform/WebPlatform.tsModuleNotFoundError: Module not found: Error: Can't resolve '../modules' in '/build/source/src/vector'wz4k8s5-element-web-modules-1.11.2/node_modules/katex/dist/katex.css 0ix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/katex/dist/katex.cssstom/css/dark-custom.pcssK2K39m
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/webpack/lib/Compilation.js:925:10
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/webpack/lib/NormalModuleFactory.js:401:22
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/webpack/lib/NormalModuleFactory.js:130:21
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/webpack/lib/NormalModuleFactory.js:224:22
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/neo-async/async.js:2830:7
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/neo-async/async.js:6877:13
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/webpack/lib/NormalModuleFactory.js:214:25
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/enhanced-resolve/lib/Resolver.js:213:14
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/enhanced-resolve/lib/Resolver.js:285:5
    at eval (eval at create (/nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/enhanced-resolve/lib/Resolver.js:285:5
    at eval (eval at create (/nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/enhanced-resolve/lib/Resolver.js:285:5
    at eval (eval at create (/nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/enhanced-resolve/lib/Resolver.js:285:5
    at eval (eval at create (/nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/enhanced-resolve/lib/RootPlugin.js:37:38
    at _next44 (eval at create (/nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:8:1)
    at eval (eval at create (/nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:31:1)
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/enhanced-resolve/lib/Resolver.js:285:5
    at eval (eval at create (/nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/enhanced-resolve/lib/Resolver.js:285:5
    at eval (eval at create (/nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/enhanced-resolve/lib/Resolver.js:285:5
    at eval (eval at create (/nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/enhanced-resolve/lib/DirectoryExistsPlugin.js:27:15
    at /nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:85:15
resolve '../modules' in '/build/source/src/vector'
  using description file: /build/source/package.json (relative path: ./src/vector)
    Field 'matrix_src_browser' doesn't contain a valid alias configuration
    Field 'browser' doesn't contain a valid alias configuration
    using description file: /build/source/package.json (relative path: ./src/modules)
      no extension
        Field 'matrix_src_browser' doesn't contain a valid alias configuration
        Field 'browser' doesn't contain a valid alias configuration
        /build/source/src/modules doesn't exist
      .js
        Field 'matrix_src_browser' doesn't contain a valid alias configuration
        Field 'browser' doesn't contain a valid alias configuration
        /build/source/src/modules.js doesn't exist
      .json
        Field 'matrix_src_browser' doesn't contain a valid alias configuration
        Field 'browser' doesn't contain a valid alias configuration
        /build/source/src/modules.json doesn't exist
      .ts
        Field 'matrix_src_browser' doesn't contain a valid alias configuration
        Field 'browser' doesn't contain a valid alias configuration
        /build/source/src/modules.ts doesn't exist
      .tsx
        Field 'matrix_src_browser' doesn't contain a valid alias configuration
        Field 'browser' doesn't contain a valid alias configuration
        /build/source/src/modules.tsx doesn't exist
      as directory
        /build/source/src/modules doesn't exist
70% building 2030/2030 modules 0 activeerror Command failed with exit code 1.es-1.11.2/node_modules/css-loader/dist/cjs.js??ref--7-1!/nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/postcss-loader/src/index.js??postcss!/nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/matrix-react-sdk/res/themes/legacy-dark/css/legacy-dark.pcss 0s5-element-web-modules-1.11.2/node_modules/matrix-react-sdk/res/themes/legacy-dark/css/legacy-dark.pcssss
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error: builder for '/nix/store/i4iakmb3l39aim2a1s8cl1jf24zrbf9j-element-web-1.11.2.drv' failed with exit code 1;
       last 10 log lines:
       >         Field 'browser' doesn't contain a valid alias configuration
       >         /build/source/src/modules.ts doesn't exist
       >       .tsx
       >         Field 'matrix_src_browser' doesn't contain a valid alias configuration
       >         Field 'browser' doesn't contain a valid alias configuration
       >         /build/source/src/modules.tsx doesn't exist
       >       as directory
       >         /build/source/src/modules doesn't exist
       > 70% building 2030/2030 modules 0 activeerror Command failed with exit code 1.es-1.11.2/node_modules/css-loader/dist/cjs.js??ref--7-1!/nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/postcss-loader/src/index.js??postcss!/nix/store/mhm6sbsl9mpknx8simv154cs1wz4k8s5-element-web-modules-1.11.2/node_modules/matrix-react-sdk/res/themes/legacy-dark/css/legacy-dark.pcss 0s5-element-web-modules-1.11.2/node_modules/matrix-react-sdk/res/themes/legacy-dark/css/legacy-dark.pcssss
       > info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
       For full logs, run 'nix log /nix/store/i4iakmb3l39aim2a1s8cl1jf24zrbf9j-element-web-1.11.2.drv'.
error: 1 dependencies of derivation '/nix/store/sygb59flmsmban7w3vcv5nmpp047k7p9-element-desktop-1.11.2.drv' failed to build

@Ma27
Copy link
Member

Ma27 commented Aug 11, 2022

Didn't have the time for it and don't expect me to be able to debug within the next 7 days. If no solution is found until then, I can take a look though :)

@yu-re-ka
Copy link
Contributor

Solutions were found...: #186133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

4 participants