pnpm / pnpm

Fast, disk space efficient package manager
https://pnpm.io
MIT License
29.75k stars 1.01k forks source link

Windows BSOD while trying to delete/move folder from a OneDrive Files On-Demand folder. #2785

Open cjavad opened 4 years ago

cjavad commented 4 years ago

I've been having an issue with managing pnpm node_modules folders inside a onedrive directory which previously has worked fine with npm. The gist of it is that when trying to delete/move a node_modules folder from said type of directory my windows computer will blue screen, this has happened 7 times so far so i am quite confident that its this combination that causes it.

When trying to remove a pnpm node_modules folder outside of the ondrive folder it behaves as one would expect. This might be an issue with how OneDrive works, but i thought i would report it here anyhow.

pnpm version: 5.4.12

Steps to reproduce the issue:

  1. Install node_modules with pnpm in a "OneDrive Files On-Demand for Windows 10" folder
  2. Try to move/delete the entire folder
  3. :)

Expected behavior:

The action would remove the folder from that location.

Actual behavior:

The explorer popup shows it's trying to remove the folder/files then subsequently blue screens.

Additional information:

cjavad commented 4 years ago

As a side note, when using WSL with ubuntu, i can remove the node_modules files just fine with rm -rf with no issues at all. This only happens when trying to use the file explorer, cmd or powershell.

zkochan commented 4 years ago

I guess this happens because pnpm creates hard links inside node_modules.

You can force pnpm to use copying instead, by setting the package-import-method setting to copy.

cjavad commented 4 years ago

Interestingly enough, when setting the copy directive installing single packages via pnpm seems to not create any issues. But when I tried pnpm install on a package.json from a react project then tried to delete the folder from onedrive (after a while has passed) the same issue occurs.

Might have something to do with onedrive removing the files locally when backing up.

Either way I think the obvious solution would be not to combine onedrive on demand with pnpm

zkochan commented 4 years ago

is it possible to tell one drive to ignore node_modules?

cjavad commented 4 years ago

You can create an empty folder called node_modules, then unselect it in Onedrive's folder selector. This doesn't apply to Onedrive configured to sync and serve on demand (when file operations are performed)

cjavad commented 4 years ago

Another solution is to make the entire node_modules folder a symlink (on windows) which makes it impossible for onedrive to sync any of it, the above solution also leads to constant sync errors from onedrive.

hinell commented 4 years ago

Who ever would want to hoist deps into ... OneDrive folder!

I mean, unless OneDrive's protocol supports hard linking it's the best to avoid pnpm's linking functionality.

statianzo commented 4 years ago

As of pnpm 5.9.0 you could explore using node-linker=pnp and symlink=false in your .npmrc to avoid creating all the links.

https://pnpm.js.org/en/npmrc#node-linker