-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Flattening feature creates lengthy folder structures #6830
Comments
We currently allow the directories inside pnpm/packages/dependency-path/src/index.ts Lines 165 to 178 in 9d4c168
We can try another approach (on Windows or on all systems). We can check what is the length of the path to the |
I also ran into this just now, and reported an ESLint bug because it crashes on Windows with |
Same issues, pnpm v8.6.5. |
@MrZhang123 maybe you want to try upgrading to Node.js 22? It looks like the Node.js v22 PR contains the fix "module,win: fix long path resolve (by @StefanStojanovic) nodejs/node#51097": So maybe Node.js has support for long paths on Windows now! (make sure that you have |
Node 22 only partially fixes the problem it went from one issue to another and ultimately still can cause problems |
Yes, sorry, my Node.js issue was reopened, Node.js v22 does not resolve the issue: |
Hello pnpm team,
I'm having an issue on Windows because of the long path names that pnpm is creating. I believe this is due to the flattening feature that creates quite lengthy folder structures. Unfortunatly, this is causing problems when I'm trying to build my project, since Windows has a limit of 260 characters for the path.
For example, I have a package
@nuxtjs [email protected]_@typescript-eslint [email protected][email protected][email protected]
. As a result, I have very long path when I try build the projectC:/Users/YourName/Documents/Projects/YourProject/node_modules/@nuxtjs [email protected]_@typescript-eslint [email protected][email protected][email protected]/some/other/directory/with/many/subdirectories/and/a/very/long/path.js
, the build process can't find the files because the path is too long.I've already tried several workarounds such as enabling long paths in Windows and moving my project closer to the root directory, but these haven't solved my problem completely.
This is not a bug of the @nuxtjs package. It occurs in our internal repositories that use the layers mechanism from Nuxt 3 and create very long paths when we want to import a file from a layer below. But this could be repeated for any deeply nested repository. For example,
C:/Users/YourName/Documents/Projects/Some-Long-Path-To-Cause-An-Error-With-Pnpm-Resolution/YourProject/node_modules/@nuxtjs [email protected]_@typescript-eslint [email protected][email protected][email protected]/index.js
. The only fix that helped me was setting the node-linker=hoisted variable to avoid creating long paths. Could you perhaps make the hashing shorter, for example, to avoid generating such long results when flattening?Could you please look into this issue and perhaps consider a way to reduce the length of the path names created by pnpm? This would help a lot for those of us who are using Windows for development, but I read that Linux also has a problem that is not written anywhere how to solve.
Thank you for your time and for developing such a helpful tool!
Best regards,
pnpm version:
pnpm -v
8.5.1/latest
Code to reproduce the issue:
shamefully-hoist=true
import file from path with loooong name, or multiple pathes and from folder @nuxtjs eslint-config@10.0.0_@typescript-eslint [email protected][email protected][email protected]
Expected behavior:
No errors
Actual behavior:
ERROR Error: ENOENT: no such file or directory, realpath
Additional information:
node -v
prints:node -v
v18.16.1
Windows, macOS, or Linux?:
Windows 10/11
The text was updated successfully, but these errors were encountered: