I've just tried testing the zwith-firebase-hosting[example](https://github.com/zeit/next.js/tree/canary/examples/with-firebase-hosting) and thenpm run devruns ok, but when i trynpm run serve` it fails with this error:
Build error occurred
{ Error: EEXIST: file already exists, mkdir '/Users/user/Sites/with-firebase-hosting/dist/functions/next'
errno: -17,
code: 'EEXIST',
syscall: 'mkdir',
path: '/Users/user/Sites/with-firebase-hosting/dist/functions/next'
}
npm ERR! errno 1
npm ERR! [email protected] build-app:next build "src/app/"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build-app script.
Follow the steps in the with-firebase-hosting example
The application to run according to the readme file.
got a similar error when i use my docker setup.
previously on 9.1.2 it didn't happen.
upgraded to 9.3.2 and the error occurs:
next build
Creating an optimized production build...
> Build error occurred
{ [Error: EEXIST: file already exists, mkdir '/app/.next']
errno: -17,
code: 'EEXIST',
syscall: 'mkdir',
path: '/app/.next' }
got a similar error when i use my docker config.
previously on 9.1.2 it didn't happen.
upgraded to 9.3.2 and the error occurs:next build Creating an optimized production build... Attention: Next.js now collects completely anonymous telemetry regarding usage. This information is used to shape Next.js' roadmap and prioritize features. You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL: https://nextjs.org/telemetry > Build error occurred { [Error: EEXIST: file already exists, mkdir '/app/.next'] errno: -17, code: 'EEXIST', syscall: 'mkdir', path: '/app/.next' }
Got the same issue. Going from 9.1.1 => 9.3.x and get the same issue with "file already exists" in the next build step. Not locally though, only get this on Netlify.
{ [Error: EEXIST: file already exists, mkdir '/opt/build/repo/.next']
errno: -17,
code: 'EEXIST',
syscall: 'mkdir',
path: '/opt/build/repo/.next' }
I am getting the following error message when running next build && next start
{ Error: EEXIST: file already exists, mkdir '/.next' errno: -17, code: 'EEXIST', syscall: 'mkdir', path: '/.next' }
I am using version 9.2.0
-- Edit --
so in my package.json file my configuration was
"next": "^9.2.0",
things working again after i set it to use a specific version
"next": "9.2.0",
Ran into the same issue. Changing from
"next": "latest", to "next": "9.2.0", seems to work. Tried installing 9.3 and it broke.
I can鈥檛 settle with 9.2 because of the security issue fixed in 9.3.2.
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-5284
Is anyone from the next team looking into this issue?
I have same error on Jenkins server, but fine on local machine.I found the error was throw from
packages\next\build\index.ts
await mkdir(distDir, { recursive: true })
recursive was support Node >=10锛孊ut my node version on jenkins server is 8.x锛宻o I update node to 10.x, problem solved. And Next.js need Node >=10 according to official document.
https://stackoverflow.com/questions/13696148/node-js-create-folder-or-use-existing/24311711
Same here - fails in AWS CodeBuild with node 10, but builds fine locally, since version 9.3.2.
@jenyayel We were on Node 10.11. When I upgraded to 10.12 it started working (as mentioned in this thread https://stackoverflow.com/questions/13696148/node-js-create-folder-or-use-existing/24311711)
Nice! I was on Node 10.10 and a simple bump to a newer version solved it!
@ShayDavidson Good one!! I was accidentally on node 8 (dont ask), and bumping to over 10.12 seemed to have worked. Thank you!!
Most helpful comment
@jenyayel We were on Node 10.11. When I upgraded to 10.12 it started working (as mentioned in this thread https://stackoverflow.com/questions/13696148/node-js-create-folder-or-use-existing/24311711)