Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENOENT: no such file or directory, copyfile #4997

Closed
zkochan opened this issue Jul 8, 2022 · 33 comments · Fixed by #5930
Closed

ENOENT: no such file or directory, copyfile #4997

zkochan opened this issue Jul 8, 2022 · 33 comments · Fixed by #5930
Assignees
Projects

Comments

@zkochan
Copy link
Member

zkochan commented Jul 8, 2022

Also having this issue after upgrading to v7. I have no idea how to reproduce it though... it works again by nuking the whole store and re-downloading everything.

 ENOENT  ENOENT: no such file or directory, copyfile '/Users/work/.pnpm-store/v3/files/68/fd2865a3cee2a68927ffed7c54667b1b3b03710b6a174ad45caa8e05f2e033b51e6d6f55ab22d8207f2fdb286c9dd057cb43171aa793ce9f180da8d7653e6e' -> '/Users/work/redacted/redacted/node_modules/.pnpm/fsevents@1.2.13/node_modules/_tmp_10595_695eb2b63757fc332de5b4c217d64f1d/build/.target.mk'

This is in MacOS by the way.

Originally posted by @rdsedmundo in #3229 (comment)

@rohanrajpal
Copy link

Facing the same issue on MacOs, pruning & deleting node modules folder does not help either.

spur on  main [$⇡] is 📦 v1.0.0 via  v16.16.0 
❯ rm -rf node_modules/                                                                                                                                                                                                                                                                                          (base) 

spur on  main [$⇡] is 📦 v1.0.0 via  v16.16.0 took 4s 
❯ pnpm store prune                                                                                                                                                                                                                                                                                              (base) 
Removed all cached metadata files
Removed 446 files
Removed 25 packages

spur on  main [$⇡] is 📦 v1.0.0 via  v16.16.0 took 2s 
❯ pnpm i                                                                                                                                                                                                                                                                                                        (base) 
Scope: all 3 workspace projects
Lockfile is up-to-date, resolution step is skipped
Packages: +1363
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /Users/rohanrajpal/Library/pnpm/store/v3
  Virtual store is at:             node_modules/.pnpm
 ENOENT  ENOENT: no such file or directory, copyfile '/Users/rohanrajpal/Library/pnpm/store/v3/files/5c/b4c2628002ae85883a99d1fa0f071eca141d4a8e18b78495114435ce759bc36665de4e25222e3691578b9627c08cb1bf7a41e9b4e36f145f98db92d27626ee-exec' -> '/Users/rohanrajpal/Documents/spurchat/code/spur/node_modules/.pnpm/sqlite3@5.0.8/node_modules/_tmp_57449_99adffdd7afc757e0d5808e1e80d95ff/node_modules/.bin/node-gyp'

pnpm: ENOENT: no such file or directory, copyfile '/Users/rohanrajpal/Library/pnpm/store/v3/files/5c/b4c2628002ae85883a99d1fa0f071eca141d4a8e18b78495114435ce759bc36665de4e25222e3691578b9627c08cb1bf7a41e9b4e36f145f98db92d27626ee-exec' -> '/Users/rohanrajpal/Documents/spurchat/code/spur/node_modules/.pnpm/sqlite3@5.0.8/node_modules/_tmp_57449_99adffdd7afc757e0d5808e1e80d95ff/node_modules/.bin/node-gyp'
Progress: resolved 1363, reused 708, downloaded 22, added 724

@zkochan
Copy link
Member Author

zkochan commented Jul 9, 2022

Is it consistently happening with sqlite3@5.0.8? Even if you remove the store completely?

@rohanrajpal
Copy link

Is it consistently happening with sqlite3@5.0.8? Even if you remove the store completely?

Completely wiped out pnpm & installed it via corepack this time, upgraded to 7.5.0 using corepack prepare pnpm@7.5.0 --activate & pnpm i worked. Tho I'm sure if I'd installed via the normal method it would have worked, most probably a store issue.

If by remove the store completely you mean pnpm store prune then yes its happening consistently, I also specifically tried to remove the mentioned store /Users/rohanrajpal/Library/pnpm/store/v3/files/5c/ and it happened again.

Or is there a better way to completely remove the store?

@zkochan
Copy link
Member Author

zkochan commented Jul 9, 2022

OK, that is good. Then probably someone with a mac can investigate this.

@tianenpang
Copy link

tianenpang commented Jul 16, 2022

I got the same issue when install sharp in Windows, tried pnpm store prune but no luck. BTW it works fine in WSL.

Reproduce:

pnpm init

pnpm add sharp

Logs:

Windows:
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: C:\Users\xxx\AppData\Local\pnpm\store\v3
  Virtual store is at:             node_modules/.pnpm
 WARN  The package linked to "node_modules\.pnpm\sharp@0.30.7\node_modules\sharp" had files with invalid names: lib\agent.js ......
 pnpm: ENOENT: no such file or directory, copyfile 'C:\Users\xxx\AppData\Local\pnpm\store\v3\files\d1\263c03c238ae779abb226db2831d67193290b1811db7e8b4320d17c378a3dddced8129ff75c5753c304b031e0f7da2ace67b03997814b38415fe252ac3f6f8' -> 'C:\Users\xxx\Desktop\sharp-demo\node_modules\.pnpm\sharp@0.30.7\node_modules\_tmp_16932_6d39e7c272ccf220ac9d6e1deadaa934\node_modules.binprebuild-install'

WSL:
Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /home/xxx/.local/share/pnpm/store/v3
  Virtual store is at:             node_modules/.pnpm
 node_modules/.pnpm/sharp@0.30.7/node_modules/sharp: Running install script, done in 4.9s
 Progress: resolved 49, reused 27, downloaded 18, added 45, done

 dependencies:
 + sharp 0.30.7

Environment:

System:
  OS: Windows 10
  WSL: Ubuntu 20.04.4 LTS
Binaries:
  pnpm: 7.5.1
  node: 16.15.1

@zkochan
Copy link
Member Author

zkochan commented Jul 16, 2022

I can't reproduce this issue on Windows.

@tianenpang
Copy link

I removed all the global packages of pnpm manually and reinstalled it via PowerShell, it works now.

@supersabillon
Copy link

We are seeing this same issue but can't reproduce locally, it only happens in our Github action using a linux runner.

I have tried removing node-modules and pruning store before doing pnpm install and still same issue.

@mlucool
Copy link

mlucool commented Aug 11, 2022

I am seeing this also on a built module (kerberos). I prune regularly, which I suspect could be related.

Any way for me to force it to reinstall one module?

@Cloud11PL
Copy link

I have the same issue on MacOS, any fixes?

@arimus
Copy link

arimus commented Aug 15, 2022

FWIW, I ran into this with Sharp on OSX as well. Hadn't had any problems and then I couldn't stop the issue. Upgraded from 7.6.0 -> 7.9.0, did a pnpm store prune and then re-ran a pnpm install and it seems to have sorted things out.

Not sure why this started happening as nothing had changed on my side deps-wise or version wise to cause the issue. Very odd.

@rdss-dheuskel
Copy link

im having this issue when running pnp install inside a container as well.

the errors are not consistently in one package. the store is on the same mounted drive.

what i noticed is that for the erroring files there exists a file with different umask:

 ENOENT  ENOENT: no such file or directory, copyfile '/srv/www/html/.pnpm-store/v3/files/cf/83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e' -> '/srv/www/html/.pnpm-store/v3/tmp/_tmp_1446_914a3edbe32aadd65663b6becd4375e1/tests/Functional/CommandLine/FileFinders/fixtures/topFolder/folder/subFolder/allowedChangesFile'

for this example

$ ls .pnpm-store/v3/files/cf/83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e*

-rw-r--r--   16 david  staff       0 Aug 18 22:56 83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
-rwxr-xr-x    1 david  staff       0 Aug 18 22:56 83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e-exec

@yangmingshan
Copy link

I ran into this issue. My solution:

  • rm pnpm-lock.yaml
  • rm -rf node_modules
  • rm -rf ~/Library/pnpm
  • pnpm install

Then it works.

@michael-land
Copy link

michael-land commented Aug 25, 2022

I ran into this issue after pnpm prune and pnpm store prune

pnpm: ENOENT: no such file or directory, copyfile
'~/Library/pnpm/store/v3/files/3e/bb8d0e7c4cabc1e6cc88debae8e0b66114e9d3a7fd019b1ed6a9f391fa8dc9b15106b53d8620a3578354cc55adac18ac148c3f6c333b520151df2a733c1659-exec' ->
'.../v5/node_modules/.pnpm/nodemon@2.0.19/node_modules/_tmp_70154_6224b9e6c68d68771e5687ef6d93f3e8/node_modules/.bin/nodemon'

not sure if this is related to nodemon postinstall scripe, but pnpm i --ignore-scripts solves my issue

@cha-kos
Copy link

cha-kos commented Aug 29, 2022

ran into this on Mac Silicon after pnpm store prune

fixed by removing the store folder with rm -rf ~/Library/pnpm/store/v3/files/

@MoKhajavi75
Copy link

Yep, i ran pnpm store prune too and then i have this problem
fixed by removing the store

@rdss-dheuskel
Copy link

the issue still persists and is only fixable by forfeiting the advantage of linking by forcing hardcopies.

@kakserpom
Copy link

I am having the same issue.

@mikehaertl
Copy link

I also have seen this issue now twice on Linux. So it's not only MacOS.

@shellscape
Copy link
Contributor

@zkochan the fix by @cha-kos works in this scenario. I'd recommend that we expend the error message for this specific error with a hint on how to fix, or remove the offending file and attempt another install automatically.

@zkochan
Copy link
Member Author

zkochan commented Nov 16, 2022

I can reproduce this error if I set verify-store-integrity to false and I remove a file from the store.

As a temporary workaround, adding hints to the error message sounds good.

@shellscape
Copy link
Contributor

I think I ran into this because I ran a prune on the store the other day. I haven't had time to verify, but that's what I suspect.

@tgmarinho
Copy link

I ran into this issue. My solution:

  • rm pnpm-lock.yaml
  • rm -rf node_modules
  • rm -rf ~/Library/pnpm
  • pnpm install

Then it works.

It's work!

This #4997 (comment) can work as well !

Thanks all

@conorzhong
Copy link

I ran into this by(in a pnpm monorepo):

rm -rf node_modules
pnpm store prune
pnpm i

env: apple m2, macOS 13.0

@SalahAdDin
Copy link

ran into this on Mac Silicon after pnpm store prune

fixed by removing the store folder with rm -rf ~/Library/pnpm/store/v3/files/

Yeah, this one!

@jeromehan
Copy link

jeromehan commented Dec 6, 2022

Also having this issue after upgrading to v7. I have no idea how to reproduce it though... it works again by nuking the whole store and re-downloading everything.

 ENOENT  ENOENT: no such file or directory, copyfile '/Users/work/.pnpm-store/v3/files/68/fd2865a3cee2a68927ffed7c54667b1b3b03710b6a174ad45caa8e05f2e033b51e6d6f55ab22d8207f2fdb286c9dd057cb43171aa793ce9f180da8d7653e6e' -> '/Users/work/redacted/redacted/node_modules/.pnpm/fsevents@1.2.13/node_modules/_tmp_10595_695eb2b63757fc332de5b4c217d64f1d/build/.target.mk'

This is in MacOS by the way.

Originally posted by @rdsedmundo in #3229 (comment)
@zkochan
pnpm i --no-side-effects-cache can be solved。
side-effects-cache=true will be problems in some cases。for example, after executing pnpm store prune '/Users/work/redacted/redacted/node_modules/.pnpm/fsevents@1.2.13/node_modules/_tmp_10595_695eb2b63757fc332de5b4c217d64f1d/build/.target.mk' not found _tmp_10595_695eb2b63757fc332de5b4c217d64f1d/build/.target.mk, so ENOENT: no such file or directory, copyfile

@unional
Copy link

unional commented Jan 3, 2023

Happens to me too. After running pnpm store prune

pnpm store status
 ENOENT  ENOENT: no such file or directory, open '/Users/hwong/Library/pnpm/store/v3/files/e4/64fe91cb365951a356cefe6e86ad68290ee45834cb89028f3901e5b022a7b1f88df9ce4b7740e8a3e2c30f56d4e10a4ca7807145617591af808eb93979949f-index.json'```

@TomasHubelbauer
Copy link

This happened to me as well as I think it was caused by me playing arround with shamefully-hoist = true in .npmrc and running pnpm install in a workspace which was already installed. Since to my knowledge toggling this option will affect how PNPM install its files, I think what happened was since the dependencies were already installed one way and I tried the other way, it broke the store somehow.

@pffigueiredo
Copy link

pffigueiredo commented Jan 13, 2023

I can reproduce this error if I set verify-store-integrity to false and I remove a file from the store.

As a temporary workaround, adding hints to the error message sounds good.

Hey @zkochan , what's happening in my situation might help you to debug further, here it goes:

  1. Everything was working fine on pnpm v6
  2. Upgraded to pnpm v7 and started having this issue's error on a container (CI)

CI STAGES

  1. [UPDATE_CACHE] I'm caching pnpm store to use in later stages, and when doing so, I'm running the following commands:
    • pnpm config set store-dir ${CI_PROJECT_DIR}/.pnpm-store (setting the store path)
    • pnpm install --frozen-lockfile -r (installing deps)
    • pnpm store prune (removing unused deps)
  2. [PROJECT_BUILD] After updating the cache, I'm actually building the project and before doing that, I'm running:
    • pnpm install --frozen-lockfile --no-verify-store-integrity -r (which should take advantage of the previous cache) => 🔴 it is while installing the deps that I get the "ENOENT  ENOENT: no such file or directory, copyfile ..." error

WORKAROUNDS

So far, I was able to work around this with 2 different "solutions":

  1. Not pruning the store on the "update-cache" stage
  2. Removing the --no-verify-store-integrity from the install stage

Does anything else comes to mind, or do you see any type of "conflicts" with the current setup?

@zkochan
Copy link
Member Author

zkochan commented Jan 15, 2023

I think I understand how the store can become corrupted by pnpm store prune. When we clear the store, we check the link attribute of the files. If nlink is 1, we assume that is not used anywhere, because no hard links are pointing to it. However, sometimes pnpm fails to create a hard link to the file in the store and it falls back to making a copy.

I still don't understand though how could it fail without verify-store-integrity=false. As far as I understand, not everyone with the issue have disabled store integrity verification.

OK, I understand why it happens! It happens with packages that have side-effects cache. We don't verify the integrity of the files from the side-effects cache.

@pchaganti
Copy link

pchaganti commented Mar 6, 2023

This is still happening with the latest version of 7.29.0. Same as @pffigueiredo above.

Created a new issue as this issue is now closed - #6187

@devotox
Copy link

devotox commented Jun 19, 2023

This is happening on patches now only on CI but the machine is not ephemeral and could have multiple installations on it

Packages are hard linked from the content-addressable store to the virtual store.
  Content-addressable store is at: /Users/administrator/pnpm/v3
  Virtual store is at:             node_modules/.pnpm
 ENOENT  ENOENT: no such file or directory, copyfile '/Users/administrator/pnpm/v3/files/fc/c8fb34921f59025292cb6cda4d53bae99945ce02ff42731ffcff4a10dedb4ece157f7a2cae1113ac1cd21f45d4b1af2b0f59dad890a44a37ab2ec1827d6640-exec' -> '/opt/actions-runner/_work/shares/shares/projects/common/node_modules/.pnpm/ts-node@10.9.1_patch_hash=x5egqwlxteg6ru2boze5fnntyy_@swc+core@1.3.55_@types+node@18.16.1_typescript@5.0.4/node_modules/_tmp_5724_77ba8c7f25f068d699e1c70d8fa79a84/node_modules/.bin/acorn'

pnpm: ENOENT: no such file or directory, copyfile '/Users/administrator/pnpm/v3/files/fc/c8fb34921f59025292cb6cda4d53bae99945ce02ff42731ffcff4a10dedb4ece157f7a2cae1113ac1cd21f45d4b1af2b0f59dad890a44a37ab2ec1827d6640-exec' -> '/opt/actions-runner/_work/shares/shares/projects/common/node_modules/.pnpm/ts-node@10.9.1_patch_hash=x5egqwlxteg6ru2boze5fnntyy_@swc+core@1.3.55_@types+node@18.16.1_typescript@5.0.4/node_modules/_tmp_5724_77ba8c7f25f068d699e1c70d8fa79a84/node_modules/.bin/acorn'

@zkochan
Copy link
Member Author

zkochan commented Jun 19, 2023

This issue was fixed. If you have the same error, see #5803 or #6187

@pnpm pnpm locked as resolved and limited conversation to collaborators Jun 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Archived in project
Status
Priority
Development

Successfully merging a pull request may close this issue.