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

WordPress Gutenberg动态块创建及编译失败问题求助

排查WordPress动态块创建及编译失败问题

需要补充的信息

  • 环境资源使用情况:安装/编译时的CPU、内存占用率
  • 手动安装@wordpress/scripts时的错误日志(若有)
  • 执行npm start时的完整错误输出
  • 系统环境细节:操作系统版本、npm版本
  • WordPress版本号
  • 项目目录的权限配置

排查步骤

1. 排查资源耗尽问题

SIGKILL通常是系统因资源不足强制终止进程,先确认这点:

  • Linux下运行top,Windows/macOS打开任务管理器,观察安装或编译时CPU、内存是否被占满
  • 若内存不足,可尝试增加Node.js内存限制:
    export NODE_OPTIONS="--max-old-space-size=2048" # 2048为内存上限,单位MB,可根据实际调整
    
    之后重新执行安装或编译命令

2. 修复npm依赖相关问题

  • 清理npm缓存:
    npm cache clean --force
    
  • 删除项目目录下的node_modules文件夹和package-lock.json文件,重新执行:
    npm install
    
  • 确认@wordpress/scripts版本兼容性,检查项目package.json的engines字段,确保Node.js v20.10.0符合要求

3. 检查权限与配置

  • 确认项目目录的所有者和权限,确保当前用户拥有读写权限
  • 检查package.json的scripts字段,确认start命令为wp-scripts start,若有误手动修正

4. 获取详细调试日志

  • 执行编译命令时添加 verbose 参数,获取更详细的错误信息:
    npm start -- --verbose
    

原始错误日志

Error: Command was killed with SIGKILL (Forced termination): npm install @wordpress/scripts --save-dev
    at makeError (/var/www/html/wordpress/wp-content/plugins/node_modules/execa/lib/error.js:59:11)
    at handlePromise (/var/www/html/wordpress/wp-content/plugins/node_modules/execa/index.js:114:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async module.exports (/var/www/html/wordpress/wp-content/plugins/node_modules/@wordpress/create-block/lib/init-wp-scripts.js:19:2)
    at async module.exports (/var/www/html/wordpress/wp-content/plugins/node_modules/@wordpress/create-block/lib/scaffold.js:151:4)
    at async Command.<anonymous> (/var/www/html/wordpress/wp-content/plugins/node_modules/@wordpress/create-block/lib/index.js:120:6) {
  shortMessage: 'Command was killed with SIGKILL (Forced termination): npm install @wordpress/scripts --save-dev',
  command: 'npm install @wordpress/scripts --save-dev',
  exitCode: undefined,
  signal: 'SIGKILL',
  signalDescription: 'Forced termination',
  stdout: '',
  stderr: '',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

Node.js v20.10.0

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.03 08:13:36