You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Yeoman生成React项目后无法运行npm start/serve命令

Fixing EACCES Error on Port 8000 for React-Webpack Yeoman Project

Hey there! I see you're new to ReactJS and Yeoman generators, and you've hit a classic port-related snag when trying to run your project. Let's break down what's going on and fix this step by step.

What's causing the error?

The Error: listen EACCES 127.0.0.1:8000 message tells us one of two things:

  • Port 8000 is already being used by another program on your computer (this is the most common culprit)
  • Your user account doesn't have permission to bind to this port (unlikely for 8000, since it's not a restricted system port, but still possible on Windows)

Solutions to try:

1. Find and stop the program using port 8000

On Windows, you can track down the process hogging the port with these steps:

  • Open Command Prompt or PowerShell
  • Run this command to find the PID (Process ID) of the program using port 8000:
    netstat -ano | findstr :8000
    
  • Look for the number in the last column (that's the PID)
  • Open Task Manager, go to the "Details" tab, find the process with that PID, right-click it, and select "End Task"
  • Now run npm run serve again—your app should start up normally

2. Change the port your React project uses

If you don't want to mess with killing processes, just switch your project to use a different unused port:

  • Open your project's root folder and find the server.js file
  • Look for a line that looks like this:
    app.listen(8000, function(err) {
      // ... rest of the server setup code
    });
    
  • Change 8000 to another port like 3000 or 8080
  • Save the file and run npm run serve again. Now access your app at http://localhost:3000 (or whatever port you chose)

3. Run your terminal as Administrator (Windows only)

While this is less likely to fix the issue for port 8000, sometimes Windows restricts access to certain ports for regular users. Give it a shot:

  • Right-click Command Prompt/PowerShell and select "Run as administrator"
  • Navigate back to your project folder and run npm run serve

Quick reminder

If you changed the port, make sure you use the new number when opening your app in the browser. For example, if you switched to 3000, go to http://localhost:3000 instead of the original 8000.

内容的提问来源于stack exchange,提问作者artist

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 06:41:03