Skip to content

NPM same logic as Node? #396

@martinheidegger

Description

@martinheidegger

I just read through the NPM code and stumbled over: find_prefix.js#L46 which basically looks-up the file-system tree to find where the node_modules or package.json folder that should be used as root for the operation.

This looks like this also needs to be done by Node.js in order to identify from where to load the packages.

About that regard I have a few questions / problems:

  1. I wasn't able to find the location of the Node.js logic. Could you point me to it? 😅
  2. What could be a reason for both Node and NPM to implement this logic separately ❓
  3. Which implementation is faster and why? 🚤
  4. Shouldn't there be just one source of truth? 💡

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions