On my Windows 11 PC I have some of my home folders located on the D: drive per this process. My %localappdata% still points to C:\Users\user\AppData\Local. I currently have my Next.js project saved to D:\Users\user\Documents\gitRepositories\myProj. I can run locally using yarn dev but when I execute yarn build I get these errors:
yarn build
▲ Next.js 14.2.4
Creating an optimized production build ...
✓ Compiled successfully
✓ Linting and checking validity of types
✓ Collecting page data
✓ Generating static pages (6/6)
✓ Collecting build traces
⚠ Failed to copy traced files for D:\Users\user\Documents\gitRepositories\myProj\.next\server\pages\_app.js [Error: ENOENT: no such file or directory, mkdir 'D:\Users\C:\Users\user\AppData\Local\Yarn\Berry\cache\next-npm-14.2.4-37fb4e5b51-10c0.zip\node_modules\next\dist\pages'] {
errno: -4058,
code: 'ENOENT',
syscall: 'mkdir',
path: 'D:\\Users\\C:\\Users\\user\\AppData\\Local\\Yarn\\Berry\\cache\\next-npm-14.2.4-37fb4e5b51-10c0.zip\\node_modules\\next\\dist\\pages'
}
⚠ Failed to copy traced files for D:\Users\user\Documents\gitRepositories\jilly-gorilly\.next\server\pages\_document.js [Error: ENOENT: no such file or directory, mkdir 'D:\Users\C:\Users\user\AppData\Local\Yarn\Berry\cache\next-npm-14.2.4-37fb4e5b51-10c0.zip\node_modules\next\dist\pages'] {
errno: -4058,
code: 'ENOENT',
syscall: 'mkdir',
path: 'D:\\Users\\C:\\Users\\user\\AppData\\Local\\Yarn\\Berry\\cache\\next-npm-14.2.4-37fb4e5b51-10c0.zip\\node_modules\\next\\dist\\pages'
}
> Build error occurred
[Error: ENOENT: no such file or directory, mkdir 'D:\Users\C:\Users\user\AppData\Local\Yarn\Berry\cache\styled-jsx-npm-5.1.1-2557a209ba-10c0.zip\node_modules\styled-jsx'] {
errno: -4058,
code: 'ENOENT',
syscall: 'mkdir',
path: 'D:\\Users\\C:\\Users\\user\\AppData\\Local\\Yarn\\Berry\\cache\\styled-jsx-npm-5.1.1-2557a209ba-10c0.zip\\node_modules\\styled-jsx'
}
Finalizing page optimization .
Notice that the paths for AppData have D:\\Users\\C:\\Users\\ prefixed in them which is not correct.
Current vs. Expected behavior
Build currently fails because invalid path is used. Expected behavior is for %localappdata% path to be used.
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Home
Available memory (MB): 16188
Available CPU cores: 8
Binaries:
Node: 20.15.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 14.2.4 // Latest available version is detected (14.2.4).
eslint-config-next: 14.2.4
react: 18.3.1
react-dom: 18.3.1
typescript: 5.5.3
Next.js Config:
output: standalone
Which area(s) are affected? (Select all that apply)
Output (export/standalone)
Which stage(s) are affected? (Select all that apply)
I encountered potentially related issue on Linux.
When I use symbolic link for globalFolder config, yarn build cannot infer path properly. (with output: standalone)
Link to the code that reproduces this issue
https://github.com/DiskCrasher/next-js-issue2
To Reproduce
On my Windows 11 PC I have some of my home folders located on the
D:
drive per this process. My%localappdata%
still points toC:\Users\user\AppData\Local
. I currently have my Next.js project saved toD:\Users\user\Documents\gitRepositories\myProj
. I can run locally usingyarn dev
but when I executeyarn build
I get these errors:Notice that the paths for AppData have
D:\\Users\\C:\\Users\\
prefixed in them which is not correct.Current vs. Expected behavior
Build currently fails because invalid path is used. Expected behavior is for
%localappdata%
path to be used.Provide environment information
Which area(s) are affected? (Select all that apply)
Output (export/standalone)
Which stage(s) are affected? (Select all that apply)
next build (local)
Additional context
No response