Skip to content

Global installs extremely slow #46

@davewasmer

Description

@davewasmer

It seems that doing any npm install -g is an order of magnitude slower with asdf-nodejs vs. a standard npm install.

My guess is that it is coming from the post install hook the seems to run on every dependency and every nested dependency for global installs. The post install hook seems to invoke bin/get-bin-names.js for each package, which just parses package.json to find bin files to shim. I'm guessing a big chunk of that time is spent starting up a node process for each package.

I'd suggest we either:

  • convert get-bin-names.js to a bash script that greps through the package.json to find the bin files (given the narrow acceptable values for the bin property in a package.json, grepping seems like it might be possible, or
  • convert bin/postinstall.sh to node and consolidating it with bin/get-bin-names.js, so we can avoid the hit for starting up a node process for each package

Happy to PR the latter approach (the former might stretch my bash-fu skills a bit) if there's any interest.

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