When building (using e.g. npx nuxt build) a Nuxt 4.2 app for deployment to an AWS Lambda environment, there are certain files that are referenced that cannot be opened because of an ENAMETOOLONG error which breaks the build process:
[error] [nuxi] Nuxt Build Error: [commonjs--resolver] ENAMETOOLONG: name too long, open '/codebuild/output/src5555555555/src/codestar-connections.awsregion.amazonaws.com/git-http/5555555555555/eu-west-2/101d57b9-2404-4be8-bd35-e386c67af5b6/orgname/reponame/virtual:nuxt:%2Fcodebuild%2Foutput%2Fsrc1203689123%2Fsrc%2Fcodestar-connections.awsregion.amazonaws.com%2Fgit-http%5555555555555%2Feu-west-2%2F101d57b9-2404-4be8-bd35-e386c67af5b6%orgname%2Freponame%2Fnode_modules%2F.cache%2Fnuxt%2F.nuxt%2Ffetch.mjs/package.json'
(org/repo/region specific data obfuscated - enough information though to show that this is what will typically happen within an AWS CodeBuild environment)
Essentially it looks as though there are certain times (about four times when I run the build in a local environment with shorter directory paths) where some kind of "virtual:nuxt" namespace is used during building, and because this namespace seems to use the current working directory URL-encoded into a string, the maximum of 256 characters for Unix filenames can easily be exceeded in a directory name. I don't know if there is an alternative strategy for building this string, or even whether what's happening here is necessary, but the build failure is frustrating and any insight or guidance towards a resolution would be gratefully received! 🙂