Skip to content

[BUG] npm install <folder> doesn't install the dependencies of that package if it is not a subdir of itself. #3318

@jcompagner

Description

@jcompagner

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

let say i have this:

c:\adir\mymainpackagedir

in that dir i have my main package that i am developing.

i want to include other packages also but some of them are local

lets say i have the same other package copies twice:

c:\adir\mymainpackagedir\myotherpackage

c:\adir\myotherpackage

so its exactly the same content

that other package has a (peer)dependency that also needs to be installed.

why i do in the dir: c:\adir\mymainpackagedir

npm install .\myotherpackage

it installs that package and the other dependency (i see 2 installed and with "npm ls" i see them)

but when i do instead:

npm install ..\myotherpackage

only the main package is installed not the dependency of that package.

why is that different?

Expected Behavior

that no matter where it the local folder package comes from the dependencies of that local package are all installed.

Steps To Reproduce

reproduce.zip

unzip the reproduce.zip

go to the "main" folder

first do

npm install ..\pckg\

you see it will only install 1 package

npm ls moment
[email protected] C:\temp\main
`-- (empty)

then uninstall it:

npm uninstall pckg

and then install the sub child folder:

npm install .\pckg\

you see it installs 2 packages and:

npm ls moment
[email protected] C:\temp\main
-- [email protected] -> C:\temp\main\pckg -- [email protected]

reports moment

Environment

  • OS: windows
  • Node: v16.2.0
  • npm: 7.14

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 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