-
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>
while absolute path or parent level ("../") provided
#4165
Comments
npm install <folder>
npm install <folder>
while absolute path or parent level ("../") provided
this is currently intended behavior. when installing a directory outside of the current one, we create a link rather than installing the dependency. when we create links we do not install the dependencies of the linked package. you can see the docs for this behavior here: https://docs.npmjs.com/cli/v8/commands/npm-install though you'll need to scroll down until you find the heading
|
although it occurs to me just now that the docs are worded wrong, and are misleading about this behavior, so i'm reopening this as a note to correct the documentation |
@nlf is there are a link to a rationale for this change somewhere? And what the suggested workaround is? Saw this discussed in #2339 also, so far I'm struggling to understand this change - it's certainly causing a lot of annoyances on my own projects (E.G. needing to recurse into each linked local package and manually run |
So if you use |
FWIW a fix for the docs has already landed in #4428. |
This behavior makes it almost impossible to consume an angular library that is installed/linked locally if the library has dependencies defined. The only way Angular can consume a locally installed/linked library is with preserveSymlinks enabled. This is because the Angular application will fail to run if there is more than one instance of the Angular framework loaded, which is what happens when preserveSymlinks is disabled. However, enabling the flag means the build will not look at the installed/linked library's node_modules folder, which then means the library's dependency won't be resolved, and the build fails. Is there any chance the linked library's dependencies could be installed, even with a flag or something? |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
npm install ../relative-path-to-my-module
doesn't resolve the dependencies of the installed modulethis happens only when path goes to the directory level up like
"my-module-a:file:../my-module-a"
or if the path is absolute.Expected Behavior
the dependencies should be installed in current module
should behave the same way as
yarn install
commandSteps To Reproduce
git clone https://github.com/spamshaker/npm-bug
npm install
my-module-b
react dependency should be resolved and installed in
my-module-b
Environment
; copy and paste output from `npm config ls` here
The text was updated successfully, but these errors were encountered: