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

Sylius 1.12执行yarn build遇EPERM端口权限错误求助

Sylius 1.12 yarn build 端口权限报错解决

问题

安装Sylius 1.12后,其他流程正常,但执行yarn build时触发端口监听权限错误,每次执行会尝试不同端口,具体报错如下:

Running webpack ...

node:events:505
      throw er; // Unhandled 'error' event
      ^

Error: listen EPERM: operation not permitted 0.0.0.0:14162
    at Server.setupListenHandle [as _listen2] (node:net:1355:21)
    at listenInCluster (node:net:1420:12)
    at Server.listen (node:net:1508:7)
    at Object.<anonymous> (/public_html/node_modules/sync-rpc/lib/worker.js:68:8)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/run_main:77:12)
    at node:internal/main/run_main_module:17:47
Emitted 'error' event on Server instance at:
    at emitErrorNT (node:net:1399:8)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'EPERM',
  errno: -1,
  syscall: 'listen',
  address: '0.0.0.0',
  port: 14162
}

[webpack-cli] Failed to load '/public_html/webpack.config.js' config
[webpack-cli] Error: Timed out waiting for sync-rpc server to start (it should respond with "pong" when sent "ping"):

node:events:505
      throw er; // Unhandled 'error' event
      ^

Error: connect ECONNREFUSED 127.0.0.1:14162
    at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1187:16)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -61,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 14162
}


    at waitForAlive (/public_html/node_modules/sync-rpc/lib/index.js:85:11)
    at start (/public_html/node_modules/sync-rpc/lib/index.js:41:3)
    at sendMessage (/public_html/node_modules/sync-rpc/lib/index.js:133:17)
    at createClient (/public_html/node_modules/sync-rpc/lib/index.js:173:27)
    at Object.<anonymous> (/public_html/node_modules/@symfony/webpack-encore/lib/plugins/eslint.js:13:32)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
error Command failed with exit code 2.

解决方法

1. 临时禁用ESLint插件

报错根源是@symfony/webpack-encore的ESLint插件依赖sync-rpc监听端口时触发权限限制,可直接禁用ESLint绕过问题:

  • 打开项目根目录的webpack.config.js
  • 找到.enableEslintPlugin()这一行,注释掉它
  • 重新执行yarn build

2. 指定可用端口范围

若需保留ESLint功能,可限定sync-rpc使用的端口范围:

  • 在项目根目录的.env文件中添加SYNC_RPC_PORT=30000-35000(选择主机允许的端口段)
  • 或在webpack.config.js中手动配置ESLint插件的RPC端口(参考@symfony/webpack-encore官方配置说明)

3. 检查主机端口权限

主机环境可能限制了普通用户的端口监听权限:

  • 联系主机服务商确认是否存在端口监听范围限制
  • 若为VPS/独立服务器,尝试用sudo yarn build执行(注意执行后需调整生成文件的所有者,避免权限问题)

4. 更新依赖包

旧版sync-rpc或@symfony/webpack-encore可能存在端口相关bug,尝试更新:

  • 执行yarn upgrade sync-rpc @symfony/webpack-encore --latest
  • 重新运行yarn install和yarn build

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.26 09:38:11