monaco-languageclient icon indicating copy to clipboard operation
monaco-languageclient copied to clipboard

Warning: package-name is trying to unpack in the same destination

Open buglessbuild opened this issue 1 year ago • 7 comments

Hello Team,

In my project, I’m using the following dependencies:

    "monaco-editor": "npm:@codingame/monaco-vscode-editor-api@~7.0.7",
    "monaco-languageclient": "~8.7.0",
    "vscode": "npm:@codingame/monaco-vscode-api@~7.0.7",
    "vscode-languageclient": "~9.0.1",
    "vscode-ws-jsonrpc": "~3.3.2"

but when I run yarn install it shows this warning in the terminal:


warning Pattern ["monaco-editor@npm:@codingame/monaco-vscode-editor-api@~7.0.7"] is trying to unpack in the same destination "/Users/hello/Library/Caches/Yarn/v6/npm-monaco-editor-7.0.11-3jaeh3jhj34j2324fk3b23g-integrity/node_modules/monaco-editor" as pattern ["monaco-editor@npm:@codingame/[email protected]"]. This could result in non-deterministic behavior, skipping.
warning Pattern ["vscode@npm:@codingame/monaco-vscode-api@~7.0.7"] is trying to unpack in the same destination "/Users/hello/Library/Caches/Yarn/v6/npm-vscode-7.0.11-k2n3b1g2k5j6h1v3g5j6h4z8j1o9-integrity/node_modules/vscode" as pattern ["vscode@npm:@codingame/[email protected]"]. This could result in non-deterministic behavior, skipping.

I’m only installing v7.0.7 but some other package is also trying to install v7.0.11. I’m using yarn package manager to install dependencies.

I tried removing ~ from the packages versions but still somehow it installs two versions. I also tried to run yarn cache clean —all before running yarn install.

Can you please help me how can I install only one version of the dependencies in my project. Thanks!

buglessbuild avatar Sep 20 '24 10:09 buglessbuild

@kaisalmen On further debugging this issue, I found out that [email protected] has monaco-editor@~7.0.7 and vscode@~7.0.7 as a direct dependency with ~. So, when I try to install mlc@~8.7.0 then it automatically upgrades the monaco-editor and vscode packages to the latest 7.0.x version as monaco-editor and vscode dependency has ~.

can we do something to prevent this issue? Is it ok to get that warning?

buglessbuild avatar Sep 20 '24 17:09 buglessbuild

@shivam6543 this is done intentionally ~ ensures that the latest patch versions are installed automatically. I don't know if yarn behaves correctly here. Do you already have lock file in place? Try yarn update to ensure all minor versions are updated to the same version.

kaisalmen avatar Sep 21 '24 08:09 kaisalmen

@kaisalmen Yes, I’ve yarn.lock file at the root of my project and I also tried running this command yarn upgrade monaco-editor monaco-languageclient vscode vscode-languageclient vscode-ws-jsonrpc

And got this output:

Output:
success Saved lockfile.
warning Workspaces can only be enabled in private projects.
warning Workspaces can only be enabled in private projects.
warning Workspaces can only be enabled in private projects.
success Saved 8 new dependencies.
info Direct dependencies
├─ [email protected]
└─ [email protected]
info All dependencies
├─ @codingame/[email protected]
├─ @codingame/[email protected]
├─ @codingame/[email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
✨  Done in 27.99s.

From the output, it doesn’t seem like it upgraded the monaco-editor and vscode package version.

When I ran the above upgrade command, I got the same warning and after the command completion, it didn’t show any changes in the yarn.lock. Am I missing something?

buglessbuild avatar Sep 22 '24 10:09 buglessbuild

@shivam6543 is what yarn list helping to reveal where the different versions come from?

kaisalmen avatar Sep 24 '24 16:09 kaisalmen

@kaisalmen here is the output of the yarn list. From the output, it seems like mlc is installing the 7.0.7 but I’ve monaco-editor and vscode as a direct dependency because of that it’s trying to install 7.0.11. Any idea how to install only one version for all the packages?

├─ [email protected]
│  ├─ @codingame/monaco-vscode-extensions-service-override@~7.0.7
│  ├─ @codingame/monaco-vscode-languages-service-override@~7.0.7
│  ├─ @codingame/monaco-vscode-localization-service-override@~7.0.7
│  ├─ @codingame/monaco-vscode-model-service-override@~7.0.7
│  ├─ monaco-editor@npm:@codingame/monaco-vscode-editor-api@~7.0.7
│  ├─ vscode-languageclient@~9.0.1
│  └─ vscode@npm:@codingame/monaco-vscode-api@~7.0.7
├─ @codingame/[email protected]
│  └─ vscode@npm:@codingame/[email protected]
├─ @codingame/[email protected]
│  └─ vscode@npm:@codingame/[email protected]
├─ @codingame/[email protected]
│  ├─ @codingame/[email protected]
│  └─ vscode@npm:@codingame/[email protected]
├─ @codingame/[email protected]
│  └─ vscode@npm:@codingame/[email protected]
├─ @codingame/[email protected]
│  └─ vscode@npm:@codingame/[email protected]
├─ @codingame/[email protected]
│  ├─ @codingame/[email protected]
│  └─ vscode@npm:@codingame/[email protected]
├─ @codingame/[email protected]
│  └─ vscode@npm:@codingame/[email protected]
├─ @codingame/[email protected]
│  └─ vscode@npm:@codingame/[email protected]
├─ @codingame/[email protected]
│  └─ vscode@npm:@codingame/[email protected]
├─ @codingame/[email protected]
│  └─ vscode@npm:@codingame/[email protected]
├─ [email protected]
│  └─ vscode@npm:@codingame/[email protected]
├─ [email protected]
│  ├─ @codingame/[email protected]
│  ├─ @codingame/[email protected]
│  ├─ @codingame/[email protected]
│  ├─ @codingame/[email protected]
│  ├─ @codingame/[email protected]
│  ├─ @codingame/[email protected]
│  ├─ @codingame/[email protected]

buglessbuild avatar Sep 25 '24 10:09 buglessbuild

@shivam6543 is possible that yarn @codingame/monaco-vscode-languages-service-override@~7.0.7 does not interpret this correctly. npm had some issues with this in the past if I remember correctly. Is it possible you try it with npm or pnpm. I need to see if I can reproduce it with yarn. Personally, I would not start a new project with yarn 1. But if that is not possible for whatever reason, we need to see if there is a solution or a workaround.

kaisalmen avatar Sep 27 '24 16:09 kaisalmen

@kaisalmen In my case, it’s not possible to use npm or pnpm. Please let us know if you find any solution or workaround for this issue.

buglessbuild avatar Sep 29 '24 18:09 buglessbuild

@shivam6543 don't know why I though about it earlier, but you can use yarn resolutions to enforce a specific version to circumvent such problems: https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/

kaisalmen avatar Oct 25 '24 14:10 kaisalmen

Closing: There was no feedback in the last three months.

kaisalmen avatar Jan 23 '25 20:01 kaisalmen