You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running npm-pack-here using the globalCacheOption for two targets, where one of the targets is a also a dependency of the other target, an error will occur like the following.
error: multiple targets are trying to pack to destination '<workingDirectory>\node_modules\<projectC>', targets: [<path-to-projectC>, <path-to-npm-pack-here-global-cache>\<projectC>]
Steps to Reproduce the Problem
Say you have three projects with the following dependency relationships
projectA depends on projectB and projectC
projectB depends on projectC (the same version as projectA)
Then running the following commands:
In projectB run npm-pack-here --target <path-to-projectC> --useGlobalCache
In projectB run the follow up yarn/npm commands to setup projectC as a local dependency, for example in this case using yarn
a. yarn add file:<path-to-npm-pack-here-global-cache>/<name-of-projectC>
b. yarn install --check-files
Then in projectA run npm-pack-here --target <path-to-projectB> <path-to-projectC> --useGlobalCache
Expected Result
No errors and the local versions of projectB and projectC pulled into projectA's node_module directory
Actual Result
The following error
error: multiple targets are trying to pack to destination '<projectA>/node_modules/<projectC>', targets: [<path-to-projectC>, <path-to-npm-pack-here-global-cache>/<projectC>]
Additional Context
Node/npm version: Node v12.18.3
Yarn: 1.22.4
OS: windows 10
The text was updated successfully, but these errors were encountered:
Main issue here is that the way npm-pack-here figures out additional local dependencies that should be packed is by looking at a project's package.jsondependencies or devDependencies. If it detects a "file" reference it follows the path to the given destination and packs the content there. That means that the packed content is targeted (not the original source of that packed content). Usually, this is not a problem but in a case as described here, it becomes one as both the original source and the packed content location are targeted.
One option to fix this is to add a .npm_pack_here file to the destination location of any packed content. That file could then have a reference back to the original target/source of the given packed content. Then when a folder with one of these files is indicated as the "target/source" (most likely through a multi level local dependency flow as described above), npm-pack-here can get the original target location to pack from.
Bug Description
When running npm-pack-here using the globalCacheOption for two targets, where one of the targets is a also a dependency of the other target, an error will occur like the following.
Steps to Reproduce the Problem
Say you have three projects with the following dependency relationships
projectA
depends onprojectB
andprojectC
projectB
depends onprojectC
(the same version asprojectA
)Then running the following commands:
projectB
runnpm-pack-here --target <path-to-projectC> --useGlobalCache
projectB
run the follow up yarn/npm commands to setup projectC as a local dependency, for example in this case using yarna.
yarn add file:<path-to-npm-pack-here-global-cache>/<name-of-projectC>
b.
yarn install --check-files
projectA
runnpm-pack-here --target <path-to-projectB> <path-to-projectC> --useGlobalCache
Expected Result
No errors and the local versions of
projectB
andprojectC
pulled intoprojectA
'snode_module
directoryActual Result
The following error
Additional Context
The text was updated successfully, but these errors were encountered: