-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] npm install <folder> doesn't install the dependencies of that package if it is not a subdir of itself. #3318
Comments
this is the intended behavior, |
Then you need to tell me what the difference is between npm install ./dir or npm install ../dir why is there a difference between those 2? also will you then adjust the documentation? https://docs.npmjs.com/cli/v7/commands/npm-install " Install the package in the directory as a symlink in the current project. Its dependencies will be installed before it's linked. If sits inside the root of your project, its dependencies may be hoisted to the top-level node_modules as they would for other types of dependencies. because that second sentence is then plain wrong. |
I've run into this as well, why is this the intended function? I was trying to test whether a project I had just split up would resolve a common dependency correctly and had to push to github before it worked correctly. Why would the folder install not resolve dependecies like all the other methods? Using npm pack unfortunately doesn't offer the same flexibility as using the folder install. Others have been complaining about this too: The docs certainly seem to say that this should work:
|
+1 This is very confusing and should NOT be the "intended behavior". Makes the development of closely related packages a total nightmare :/ |
i also still don't get why this difference must be there, it seems that you really need to program this out to do different things.. |
It would be helpful to at least have a flag for |
+1 I'm developing a public lib and, in parallel, an application that uses it (both in typescript). It is extremely annoying and complex to have to run "npm run build", "npm pack", "npm install", "npm run build" and finally "npm start"/"npm test" for every small correction and/or feature implemented. This slows down the development of applications like this by a lot, and based on the other comments, certainly other people agree with me. |
Any idea why this is closed? This is still the default behavior. Well, they changed the docs:
So, if the project is outside your root, it is linked, but it's dependencies not installed. |
With Yarn this works, and on NPM has been broken since forever Another reason to migrate |
@Yehonal Can confirm |
@nlf Would you care to reopen this issue or explain the benefit of the current behavior to the community? |
We are in a similar situation to this:
|
Is there an existing issue for this?
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
main@1.0 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
main@1.0 C:\temp\main
-- pckg@1.0 -> C:\temp\main\pckg
-- moment@2.29.1reports moment
Environment
The text was updated successfully, but these errors were encountered: