Skip to content

ncu -g fails with Snap binary: child_process.spawn produces empty string #27557

Closed
@kleinfreund

Description

@kleinfreund

I switched from the PPA binary (https://github.com/nodesource/distributions/blob/master/README.md#debinstall) to the snap binary (https://snapcraft.io/node). This started to break the ncu -g command. Originally, I opened an issue with npm-check-updates, but it doesn’t seem to be an issue on their end (for reference: raineorshine/npm-check-updates#536).

Only with the snap binary do I get the following error:

/home/phil/.npm-global/lib/node_modules/npm-check-updates/lib/npm-check-updates.js:387
        throw err;
        ^

Error: Expected JSON from "npm ls". This could be due to npm instability.


    at parseJson (/home/phil/.npm-global/lib/node_modules/npm-check-updates/lib/package-managers/npm.js:38:15)
    at /home/phil/.npm-global/lib/node_modules/npm-check-updates/lib/package-managers/npm.js:144:30
    at processTicksAndRejections (internal/process/task_queues.js:89:5)

The command that is executed with child_process.spawn is npm ls --global --depth=0 --json which produces the correct JSON with both the PPA and the snap binary when executed directly from the terminal.

Metadata

Metadata

Assignees

No one assigned

    Labels

    wrong repoIssues that should be opened in another repository.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions