question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Emitted 'error' event on WriteStream instance

See original GitHub issue

What version of Next.js are you using?

12.0.2

What version of Node.js are you using?

v14.11.0

What browser are you using?

chrome

What operating system are you using?

windows

How are you deploying your application?

next run build

Describe the Bug

Hi,

When making a build for production, I keep getting this error. I never had the issue before upgrading to version 12.0.0. I tried deleting the file, but it only works when the dev server is not running, while it runs I cannot open or delete it and that make every production build fail.

info  - Creating an optimized production build .events.js:291
      throw er; // Unhandled 'error' event
      ^

Error: EPERM: operation not permitted, open 'D:\[...]\.next\trace'
Emitted 'error' event on WriteStream instance at:
    at D:\[...]\node_modules\next\dist\compiled\@vercel\nft\index.js:1:287421
    at D:\[...]\node_modules\next\dist\compiled\@vercel\nft\index.js:1:287860
    at FSReqCallback.oncomplete (fs.js:164:23) {
  errno: -4048,
  code: 'EPERM',
  syscall: 'open',
  path: 'D:\\[...]\\.next\\trace'
}

Expected Behavior

I expect it to work when building

To Reproduce

clone the with-typescript example, run npm run dev and once done npm run build

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

21reactions
maximegheraillecommented, Nov 2, 2021

I might have found the problem. I used the with-typescript example. When running npm run buid it works fine but when I have dev running via npm run dev and I build it, it gives that error. Before version 12.0.0 is always had the dev running while doing a production build (it was required for production build if I am not wrong).

19reactions
avdhootkcommented, Dec 6, 2021

you just need to stop the npm run dev and then run npm run build, that works for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Emitted 'error' event on WriteStream instance - next.js
When making a build for production, I keep getting this error. I never had the issue before upgrading to version 12.0. 0. I...
Read more >
Node.js Readable Stream error Event - GeeksforGeeks
The 'error' event in Readable stream can be emitted at any time. It takes place when the hidden stream is not able to...
Read more >
emitted 'error' event on writestream instance at - You.com
The 'error' event in Readable stream can be emitted at any time. It takes place when the hidden stream is not able to...
Read more >
NodeJS writeStream 'Einval' error when running in crontab ...
Error: EINVAL: invalid argument, open 'my path goes here'' Emitted 'error' event on WriteStream instance at: at internal/fs/streams.js:361: ...
Read more >
Newbie getting build errors with Next.JS : r/reactjs - Reddit
... open 'C:\Users\Simon\Desktop\@Documents\@@Projects\Coding\@web\portfolio\.next\trace' Emitted 'error' event on WriteStream instance at: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found