pnpm: ENAMETOOLONG error during installation

pnpm version: 6.32.2

Code to reproduce the issue:

pnpm add box-ui-elements

Expected behavior:

Installation succeeds

Actual behavior:

Installation fails due to ENAMETOOLONG

Additional information:

  • node -v prints: v16.14.0
  • Windows, macOS, or Linux?: Linux

Cross-post from https://github.com/box/box-ui-elements/issues/2871.

I’m attempting to install box-ui-elements on my Linux machine, and it fails with the following output:

Packages: +1
+
 ENAMETOOLONG  ENAMETOOLONG: name too long, copyfile '/home/user/.pnpm-store/v3/files/ba/9a6e35378e8d6859ba72ec631d471026a46c209e65f541edd8e6954696b654ecf2e9dd4a26f237f984008ad9edeeaa3f137955974b24b3876d10177da09152' -> '/home/user/my-project/node_modules/.pnpm/box-ui-elements@14.0.0_16d78d4c5865b42183e731c766aacdba/node_modules/_tmp_66219_65d97d6eb7799a708d621fb8c1129bd9/src/components/avatar/__tests__/__image_snapshots__/avatar-stories-test-tsx-components-avatar-avatar-looks-visually-correct-when-using-story-components-avatar-with-url-fallback-to-initials-1-snap.png'
Progress: resolved 1395, reused 1366, downloaded 0, added 0

I’m able to install it successfully on Windows running in a VM. However, I got the same ENAMETOOLONG error when attempting to run pnpm install, after committing the changes to package.json from my Windows VM.

Any idea what is going on here? And any ways to work around this?

Is there any way I can just skip copying the files that throw this error for me?

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

for all you having this issue, it’s a limitation by the linux kernel when it comes to path length, the default path for the pnpm store is usually /home/<your_user>/.local/share/pnpm/store (i think, i can’t recall it well), so when you try installing a package that has dependencies with very very long names, you get the error ENAMETOOLONG, try this for a fix, it worked for me.

Move the store to /opt and change perms so that pnpm can read,write and modify files in that folder, it usually belong to root on creation.

mkdir /opt/pnpm-store
pnpm config set store-dir /opt/pnpm-store
sudo chown -R $(whoami):$(whoami) /opt/pnpm-store/

then head over to your project, remove the node_modules folder with rm -rf node_modules and then install them again with pnpm install.

done 👍

@michaelhays I have the same problem on Linux Mint 21.1

@hosswald @dsmurl @MAN-Sendance I think your issue is unrelated to OP, but related to #2605 (edit: and now #6842), i.e. that’s an issue with pnpm on ecryptfs. Try to rollback to pnpm 7.33.5 (npm install -g pnpm@7.33.5).

The issue is still here, so install is still impossible with pnpm 9 (Linux Mint 21).