Pnpm: package-import-method=clone does not work if modules are already in the pnpm store

Created on 23 Apr 2020  路  4Comments  路  Source: pnpm/pnpm

pnpm version: 4.14.0 (tested with 5.4.0 too)

Code to reproduce the issue:

.npmrc:

loglevel=silly
registry=***
strict-ssl=***
init.author.name=***
init.author.email=***
_auth=***
email=***
always-auth=***
proxy=***
package-import-method=copy
shamefully-hoist=true

Execution:

$ pnpm i
$ ls -la node_modules // will show that the files are copied

$ rm -rf node_modules

$ pnpm i
$ ls -la node_modules // will show that the files linked

Expected behavior:

Independently of the number of executions, the node modules are copied from the pnpm store into node_modules.

Actual behavior:

On the first execution, the modules are copied from pnpm store into the node_modules.
On the second execution, the modules are linked from pnpm store into the node_modules.

Additional information:

  • node -v prints: v12.10.0 (tested with 14.5.0 too)
  • Windows, OS X, or Linux?: Windows, OS X, and Linux

Most helpful comment

I can look into it after I finish work on pnpm v5

All 4 comments

Hi @zkochan, please let me know if you want me to provide more information.

Best regards,
Florian

I can look into it after I finish work on pnpm v5

@zkochan , thank you for the great work! I just tried it with v5.5.2. The problem seems to exist in this version too.

Best,
Florian

I don't see any issues.

There is no difference in the output of ls -la node_modules when you run it on copied node_modules vs hard linked node_modules. ls -la node_modules will print symlinks. pnpm always creates symlinks to packages in the virtual store direcory (node_modules/.pnpm).

Hard linking means just that the files in the virtual store are hard linked from the global store.

I think you misunderstood what this option is for. If you want a flat node_modules, where the package are copied to the root, not symlinked, that is not possible with pnpm.

Was this page helpful?
0 / 5 - 0 ratings