Skip to content

[BUG] symlinks missing for dependencies of locally installed modules #3185

Closed
@tstibbs

Description

@tstibbs

Current Behavior:

When installing a module from npm, symlinks are created in node_modules/.bin/ for that dependency and any transitive dependencies.
When installing a module from a local directly, symlinks are created in node_modules/.bin/ for that dependency but not any transitive dependencies.

Expected Behavior:

Installing a module from a local directory should behave the same as installing from npm, i.e. should set up symlinks to all transitive dependencies of the module being installed.

Steps To Reproduce:

To reproduce, install the cowsay_quote module

  • cowsay_quote depends on cowsay.
  • cowsay_quote creates the link cowsayq.
  • cowsay creates the links cowsay and cowthink.

To see expected behaviour (when installing module from npm):

mkdir working
cd working
npm install [email protected]
ls -al node_modules/.bin/ # has symlinks for cowsay_quote and all dependent modules recursively
npx cowsayq # works
npx cowsay # works
npx cowthink # works

To see buggy behaviour (when installing module from local directory)

git clone https://github.com/maheshstms/cowsay-quote.git
cd cowsay-quote
git checkout 1b23026 # commit for 1.3.0, just to ensure we're doing something identical
npm install
cd ../
mkdir notworking
cd notworking
npm install ../cowsay-quote/
ls -al node_modules/.bin/ # only has symlinks for cowsay_quote
npx cowsayq # works
npx cowsay # offers to install module even though it should be installed
npx cowthink # not found

Environment:

  • OS: Ubuntu 20.04 (in WSL 2)
  • Node: 14.8.0
  • npm: 7.10.0

Other

Note this may be related to #3081, but I believe it's a slightly different bug to the one reported there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 1high priority issueRelease 7.xwork is associated with a specific npm 7 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions