flatpak / flatpak-builder-tools

Various helper tools for flatpak-builder
198 stars 107 forks source link

flatpak-node-generator: KeyError: 'name' #418

Open faveoled opened 3 months ago

faveoled commented 3 months ago

flatpak-builder version

1.4.4

Linux distribution and version

Ubuntu 22.04

Affected flatpak-builder tool

node/flatpak-node-generator.py

flatpak-builder tool cli args

No response

Source repository URL

No response

Flatpak-builder manifest URL

No response

Description

$ flatpak-node-generator npm package-lock.json 
Reading packages from lockfiles...
Traceback (most recent call last):
  File "/home/user/.local/bin/flatpak-node-generator", line 8, in <module>
    sys.exit(main())
  File "/home/user/.local/share/pipx/venvs/flatpak-node-generator/lib/python3.10/site-packages/flatpak_node_generator/main.py", line 277, in main
    asyncio.run(_async_main())
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/user/.local/share/pipx/venvs/flatpak-node-generator/lib/python3.10/site-packages/flatpak_node_generator/main.py", line 198, in _async_main
    packages.update(lockfile_provider.process_lockfile(lockfile))
  File "/home/user/.local/share/pipx/venvs/flatpak-node-generator/lib/python3.10/site-packages/flatpak_node_generator/providers/npm.py", line 166, in process_lockfile
    yield from self._process_packages_v2(lockfile, data)
  File "/home/user/.local/share/pipx/venvs/flatpak-node-generator/lib/python3.10/site-packages/flatpak_node_generator/providers/npm.py", line 119, in _process_packages_v2
    name = json.load(fp)['name']
KeyError: 'name'

On this package-lock.json

ReenigneArcher commented 1 month ago

Add "name": "<your-project-name>" to your package.json file, then recreate your package-lock.json