存储在 Windows
Store on Windows
不知道是bug还是理解不够。我不明白 pnpm 商店在 Windows.
上是如何运作的
比如说,我在 C: 上使用文件夹 "test" - 商店 (.pnpm-store) 是在 %USERPROFILE% 中创建的。当我在另一个驱动器上有这个文件夹 "test" 时,存储在 "test" 中创建。此外,当这个驱动器上有另一个文件夹 "test2" 时,将在 "test2" 中创建另一个新存储。 IMO,这个(其他 - 不是 c)驱动器上的 "test" 和 "test2" 应该在这个驱动器的根目录中使用一个存储(是的,我的用户可以在那里创建一个文件夹),不是吗。
然后,假设我有一个文件夹 "test",里面有一个名为 "package1" 的包文件夹,我通过 "pnpm init -y" 创建了 package.json。现在我添加一个包,例如"pnpm add debug"。 IMO 应该引用这个驱动器上的商店。但它不是:
C:\test\package1>dir /s | findstr JUNCTION
10.10.2019 13:25 <JUNCTION> debug [C:\test\package1\node_modules\.pnpm\registry.npmjs.org\debug.1.1\node_modules\debug]
10.10.2019 13:25 <JUNCTION> ms [C:\test\package1\node_modules\.pnpm\registry.npmjs.org\ms.1.2\node_modules\ms]
10.10.2019 13:25 <JUNCTION> ms [C:\test\package1\node_modules\.pnpm\registry.npmjs.org\ms.1.2\node_modules\ms]
所以怎么了?
drive should use a store in the root of this drive (yes, my user can create a folder there), shouldn't it.
当您在用户目录所在的同一驱动器上安装时,将在用户目录中创建商店。当您在其他驱动器上安装时,商店会在驱动器的根目录下创建(例如,在 D:\.pnpm-store
)
the store on this drive should be referenced. But it isn't
您在项目中看到的包实际上与商店中的包相同。很难link。来自 pnpm FAQ page 的更多详细信息:
pnpm creates hard links from the global store to project's
node_modules folders. Hard links point to the same place on the disk
where the original files are. So, for example, if you have foo in your
project as a dependency and it occupies 1MB of space, then it will
look like it occupies 1MB of space in the project's node_modules
folder and the same amount of space in the global store. However, that
1MB is the same space on the disk addressed from two different
locations. So in total foo occupies 1MB, not 2MB.
不知道是bug还是理解不够。我不明白 pnpm 商店在 Windows.
上是如何运作的比如说,我在 C: 上使用文件夹 "test" - 商店 (.pnpm-store) 是在 %USERPROFILE% 中创建的。当我在另一个驱动器上有这个文件夹 "test" 时,存储在 "test" 中创建。此外,当这个驱动器上有另一个文件夹 "test2" 时,将在 "test2" 中创建另一个新存储。 IMO,这个(其他 - 不是 c)驱动器上的 "test" 和 "test2" 应该在这个驱动器的根目录中使用一个存储(是的,我的用户可以在那里创建一个文件夹),不是吗。
然后,假设我有一个文件夹 "test",里面有一个名为 "package1" 的包文件夹,我通过 "pnpm init -y" 创建了 package.json。现在我添加一个包,例如"pnpm add debug"。 IMO 应该引用这个驱动器上的商店。但它不是:
C:\test\package1>dir /s | findstr JUNCTION
10.10.2019 13:25 <JUNCTION> debug [C:\test\package1\node_modules\.pnpm\registry.npmjs.org\debug.1.1\node_modules\debug]
10.10.2019 13:25 <JUNCTION> ms [C:\test\package1\node_modules\.pnpm\registry.npmjs.org\ms.1.2\node_modules\ms]
10.10.2019 13:25 <JUNCTION> ms [C:\test\package1\node_modules\.pnpm\registry.npmjs.org\ms.1.2\node_modules\ms]
所以怎么了?
drive should use a store in the root of this drive (yes, my user can create a folder there), shouldn't it.
当您在用户目录所在的同一驱动器上安装时,将在用户目录中创建商店。当您在其他驱动器上安装时,商店会在驱动器的根目录下创建(例如,在 D:\.pnpm-store
)
the store on this drive should be referenced. But it isn't
您在项目中看到的包实际上与商店中的包相同。很难link。来自 pnpm FAQ page 的更多详细信息:
pnpm creates hard links from the global store to project's node_modules folders. Hard links point to the same place on the disk where the original files are. So, for example, if you have foo in your project as a dependency and it occupies 1MB of space, then it will look like it occupies 1MB of space in the project's node_modules folder and the same amount of space in the global store. However, that 1MB is the same space on the disk addressed from two different locations. So in total foo occupies 1MB, not 2MB.