Skip to content

Shim all npm installable binaries #137

@iamogbz

Description

@iamogbz

Is your feature request related to a problem? Please describe.

While this shims node, npm and npx to use the current project/global version. The binaries installed after an npm install are not shimmed. The correct bins are still accessible via npx, but that's not as intuitive as just running eslint directly.

Describe the solution you'd like

  • npm install eslint installs eslint using the current project version npm
  • which eslint points to the eslint in the correct npm bin path
  • Launch a new shell
  • which eslint should still be shimmed to the correct bin based on current project version

Describe alternatives you've considered

  1. Shim all binaries post npm installation.
    After the shimmed node binaries run, check the current version npm bin -g and add a shim for any new npm installed binaries that would handle redirecting to the correct version based on the current project.

    • Maybe include an environment variable NVSHIM_AUTO_INSTALL_SHIM=1 that controls if globally installed bins should have specific shims created
    • When a global shim does not exist for the current version of node what is the behaviour? Print warning and instructions?
      Attempting to call global `eslint` but it is not installed for `node` v16.2.1.
      Run `npm -g install eslint` to install for your current version.
      Or switch your `nvm` config to a version that has it installed.
      Available local node versions are `18.9.0`, `16.2.1`, `14.7.1`.
  2. Configure the PATH to include npm binaries.
    After nvshim is installed, configure the shell to set up dynamic environment PATH. Although at this point how is it different from the other solutions that modify the shell on directory change.

  3. Do nothing.
    npx is sufficient, just document that this is not within the scope of the project.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions