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

Yarn translator cannot handle empty version spec #73

Closed
max-privatevoid opened this issue Jan 11, 2022 · 1 comment · Fixed by #74
Closed

Yarn translator cannot handle empty version spec #73

max-privatevoid opened this issue Jan 11, 2022 · 1 comment · Fixed by #74

Comments

@max-privatevoid
Copy link
Contributor

No idea if this would even be a valid yarn lockfile. From here:
https://github.com/TryGhost/Admin/blob/b872df2e0eee3ca07c5717a36ef1f5fa0cc97c1d/yarn.lock#L6224

$ nix run github:nix-community/dream2nix -- add github:TryGhost/Admin/b872df2e0eee3ca07c5717a36ef1f5fa0cc97c1d
(...)
Translating project metadata
error: parser failed at:
           ember-get-config ""
           lodash.defaults "^4.2.

       … while evaluating 'mapAttrsToList'

       at /nix/store/ygz58w4f2hgnrdwa657k7gkx3ajd6d8r-bs58z9v8mfd6hxh9zwhsmyzlmiamhqjj-p53cz6rh27q40g9i0q98k3vfrz6lm12w-source/lib/attrsets.nix:258:23:

          257|   */
          258|   mapAttrsToList = f: attrs:
             |                       ^
          259|     map (name: f name attrs.${name}) (attrNames attrs);

       … from call site

       at /nix/store/pp50mg5zjm4if97n27wncqmpbj9x0j3y-49xvflbb44ffsmkjysmrkf0kvk8fmd96-dream2nix-full-src/translators/nodejs/pure/yarn-lock/default.nix:104:11:

          103|         serializePackages = inputData:
          104|           lib.mapAttrsToList
             |           ^
          105|             (yarnName: depAttrs: depAttrs // { inherit yarnName; })

       … while evaluating 'serializePackages'

       at /nix/store/pp50mg5zjm4if97n27wncqmpbj9x0j3y-49xvflbb44ffsmkjysmrkf0kvk8fmd96-dream2nix-full-src/translators/nodejs/pure/yarn-lock/default.nix:103:29:

          102|
          103|         serializePackages = inputData:
             |                             ^
          104|           lib.mapAttrsToList

       … from call site

       at /nix/store/pp50mg5zjm4if97n27wncqmpbj9x0j3y-49xvflbb44ffsmkjysmrkf0kvk8fmd96-dream2nix-full-src/utils/translator.nix:43:32:

           42|
           43|       serializedPackagesList = final.serializePackages final.inputData;
             |                                ^
           44|

       … while evaluating 'findCycles'

       at /nix/store/pp50mg5zjm4if97n27wncqmpbj9x0j3y-49xvflbb44ffsmkjysmrkf0kvk8fmd96-dream2nix-full-src/utils/translator.nix:167:45:

          166|             let
          167|               findCycles = node: prevNodes: cycles:
             |                                             ^
          168|                 let

       … from call site

       at /nix/store/pp50mg5zjm4if97n27wncqmpbj9x0j3y-49xvflbb44ffsmkjysmrkf0kvk8fmd96-dream2nix-full-src/utils/translator.nix:202:17:

          201|               cyclesList =
          202|                 findCycles
             |                 ^
          203|                   (utils.nameVersionPair mainPackageName mainPackageVersion)

       … while evaluating the attribute 'cyclicDependencies'

       at /nix/store/pp50mg5zjm4if97n27wncqmpbj9x0j3y-49xvflbb44ffsmkjysmrkf0kvk8fmd96-dream2nix-full-src/utils/translator.nix:252:20:

          251|
          252|             inherit cyclicDependencies;
             |                    ^
          253|

       … while evaluating 'compressDependencyGraph'

       at /nix/store/pp50mg5zjm4if97n27wncqmpbj9x0j3y-49xvflbb44ffsmkjysmrkf0kvk8fmd96-dream2nix-full-src/utils/dream-lock.nix:183:31:

          182|
          183|     compressDependencyGraph = decompGraph:
             |                               ^
          184|       lib.mapAttrs

       … from call site

       at /nix/store/pp50mg5zjm4if97n27wncqmpbj9x0j3y-49xvflbb44ffsmkjysmrkf0kvk8fmd96-dream2nix-full-src/utils/dream-lock.nix:226:11:

          225|         cyclicDependencies =
          226|           compressDependencyGraph
             |           ^
          227|             uncomp.cyclicDependencies;

       … while evaluating 'toJSON'

       at /nix/store/pp50mg5zjm4if97n27wncqmpbj9x0j3y-49xvflbb44ffsmkjysmrkf0kvk8fmd96-dream2nix-full-src/utils/dream-lock.nix:244:14:

          243|
          244|     toJSON = dreamLock:
             |              ^
          245|       let

       … from call site

       at «string»:8:7:

            7|     in
            8|       dream2nix.utils.dreamLock.toJSON
             |       ^
            9|         # don't use nix to detect cycles, this will be more efficient in python

  Exception

  Translator failed to create dream-lock.json

  at /nix/store/ig5if3b8b7rq70x2z21nvb2k347fdlyj-cli/commands/add.py:476 in run_translate
      472│         )
      473│ 
      474│       # raise error if output wasn't produced
      475│       if not output_temp_file.read():
    → 476│         raise Exception(f"Translator failed to create dream-lock.json")
      477│ 
      478│       # read produced lock file
      479│       with open(output_temp_file.name) as f:
      480│         lock = json.load(f)

@nrdxp
Copy link
Contributor

nrdxp commented May 19, 2022

Not the exact same error, but what I'm getting seems related:

error: value is null while a list was expected

       at /nix/store/wh5ppx82dslh8p6p07qjk7wc227ls8q6-source/src/translators/nodejs/pure/yarn-lock/default.nix:200:35:

          199|                         inherit name;
          200|                         version = b.elemAt versionMatch 0;
             |                                   ^
          201|                       }

The parser seems to have comepletey changed since this time, and the fix in the linked PR no longer exists so perhaps this is a different iteration of a similar issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants