Skip to content
This repository has been archived by the owner on Feb 15, 2022. It is now read-only.

npm ls "forgets" nested linked dependencies when run programmatically #8

Open
cressie176 opened this issue Jul 15, 2013 · 0 comments
Open

Comments

@cressie176
Copy link

npm.commands.ls drops nested linked libraries when run programmatically. e.g.

module-a/package.json

{
    "name": "module-a",
    "dependencies": {
        "module-b" : "*",
    }
}

module-b/package.json

{
    "name": "module-b",
    "dependencies": {
        "module-c" : "*",
    }
}

module-c/package.json

{
    "name": "module-c",
}
npm.load({}, function() {
    npm.prefix = './work/module-a/';
    npm.commands.ls(undefined, true, function(err, full, lite) {
        console.log("Module A\n", lite);
        npm.prefix = './work/module-b'/;
        npm.commands.ls(undefined, true, function(err, full, lite) {
            console.log("Module B\n", lite);           
        });
    });
});

The output from the second 'ls' command does not list Module C as a dependency of Module B

The bug is in read_installed, and to do with the use of rpSeen. While traversing module-A's dependencies npm correctly detects that Module-B depends on Module-C, but after returning, this information is not present in the object stashed in rpSeen.

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

No branches or pull requests

1 participant