Skip to content

[node] npm provider's generated-sources.json missing many packages (ENOTCACHED) #377

@Ian2020

Description

@Ian2020

flatpak-builder version

1.3.3

Linux distribution and version

Fedora 38

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

I have found many sources are missing from generated-sources.json when using the npm provider (under certain conditions). When it comes to running the flatpak-builder you see something like this:

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

I have a package-lock.json with over 1000 packages but flatpak-node-generator only produces 90 sources.

When I debugged the code of flatpak-node-generator I could see it was treating many packages' source as being of type LocalSource (which excludes them from generated sources) despite that not being the case. This is due (I believe) to a subtle bug in the code where if a package json file exists for a package in a local node_modules dir where flatpak-node-generator is run then the package will always be treated as local.

Deleting/renaming your node_modules dir before running flatpak-node-generator in the project's repository will workaround the issue but I am preparing a PR to fix the real issue also.

I believe this may also be the same bug as #244 which was closed when the OP switched to yarn.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions