Error Running Next.js Project on Multiple Ports in Windows Environment
Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
Provide environment information
next info
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Binaries:
Node: 18.17.0
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 13.4.12
eslint-config-next: N/A
react: 18.2.0
react-dom: 18.2.0
typescript: N/A
Next.js Config:
output: N/A
Which area(s) of Next.js are affected? (leave empty if unsure)
No response
Link to the code that reproduces this issue or a replay of the bug
Can only reproduce in local development.
To Reproduce
Navigate to the project directory in the command prompt. Open the first terminal instance and execute the command: npm run dev -- --port 3000. Open the second terminal instance and execute the command: npm run dev -- --port 3001.
Describe the Bug
When attempting to run a Next.js project on multiple ports simultaneously in a Windows 10 environment with Node.js v18.17.0, an error is encountered. The project is started using two separate terminal instances, each specifying a different port using the npm run dev command. However, the project fails to run due to an "EPERM: operation not permitted" error when attempting to open the D:\Development\next-app.next\trace file.
npm run dev -- --port 3001
[email protected] dev next dev --port 3001
- ready started server on 0.0.0.0:3001, url: http://localhost:3001
- event compiled client and server successfully in 177 ms (18 modules) node:events:492 throw er; // Unhandled 'error' event ^
Error: EPERM: operation not permitted, open 'D:\Development\next-app.next\trace' Emitted 'error' event on WriteStream instance at: at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { errno: -4048, code: 'EPERM', syscall: 'open', path: 'D:\Development\next-app\.next\trace' }
Node.js v18.17.0
The project fails to run on the second port (3001) due to an "EPERM: operation not permitted" error when attempting to open the D:\Development\next-app.next\trace file.
Expected Behavior
The Next.js project should run successfully on both ports 3000 and 3001, enabling access through the URLs: http://localhost:3000 and http://localhost:3001.
Which browser are you using? (if relevant)
Chrome 115.0.5790.111
How are you deploying your application? (if relevant)
No response
You need to enable Windows Developer Mode - https://www.howtogeek.com/292914/what-is-developer-mode-in-windows-10/
This works for me 🫡
This issue has been automatically marked as stale due to inactivity. It will be closed in 7 days unless there’s further input. If you believe this issue is still relevant, please leave a comment or provide updated details. Thank you.
This issue has been automatically closed due to inactivity. If you’re still experiencing a similar problem or have additional details to share, please open a new issue following our current issue template. Your updated report helps us investigate and address concerns more efficiently. Thank you for your understanding!