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

使用Taro开发小程序遇SIGSEGV错误,求排查package.json问题

Taro小程序运行报错"error Command failed with signal 'SIGSEGV'"排查方案

我使用Taro 3.6.2开发小程序,运行时触发报错:error Command failed with signal "SIGSEGV",已尝试删除node_modules并重新执行npm install,问题仍未解决。我的package.json配置如下:

{
  "name": "publish",
  "version": "1.0.0",
  "private": true,
  "description": "",
  "templateInfo": {
    "name": "default-youshu",
    "typescript": true,
    "css": "sass"
  },
  "scripts": {
    "build:weapp": "taro build --type weapp",
    "build:swan": "taro build --type swan",
    "build:alipay": "taro build --type alipay",
    "build:tt": "taro build --type tt",
    "build:qq": "taro build --type qq",
    "dev:weapp": "npm run build:weapp -- --watch",
    "dev:swan": "npm run build:swan -- --watch",
    "dev:alipay": "npm run build:alipay -- --watch",
    "dev:tt": "npm run build:tt -- --watch",
    "dev:qq": "npm run build:qq -- --watch"
  },
  "browserslist": [
    "last 3 versions",
    "Android >= 4.1",
    "ios >= 8"
  ],
  "author": "",
  "dependencies": {
    "@babel/runtime": "^7.7.7",
    "@tarojs/components": "3.6.2",
    "@tarojs/helper": "3.6.2",
    "@tarojs/plugin-framework-react": "3.6.2",
    "@tarojs/plugin-html": "^3.6.2",
    "@tarojs/plugin-platform-alipay": "3.6.2",
    "@tarojs/plugin-platform-h5": "3.6.2",
    "@tarojs/plugin-platform-jd": "3.6.2",
    "@tarojs/plugin-platform-qq": "3.6.2",
    "@tarojs/plugin-platform-swan": "3.6.2",
    "@tarojs/plugin-platform-tt": "3.6.2",
    "@tarojs/plugin-platform-weapp": "3.6.2",
    "@tarojs/react": "3.6.2",
    "@tarojs/runtime": "3.6.2",
    "@tarojs/shared": "3.6.2",
    "@tarojs/taro": "3.6.2",
    "node-sass": "^8.0.0",
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "react-responsive-carousel": "^3.2.23",
    "sr-sdk-wxapp": "^1.3.6",
    "taro-axios": "^1.1.1"
  },
  "devDependencies": {
    "@babel/core": "^7.8.0",
    "@pmmmwh/react-refresh-webpack-plugin": "^0.5.5",
    "@tarojs/cli": "3.6.2",
    "@tarojs/webpack5-runner": "3.6.2",
    "@types/react": "^18.0.0",
    "@types/webpack-env": "^1.13.6",
    "@typescript-eslint/eslint-plugin": "^5.20.0",
    "@typescript-eslint/parser": "^5.20.0",
    "babel-preset-taro": "3.6.2",
    "eslint": "^8.12.0",
    "eslint-config-taro": "3.6.2",
    "eslint-plugin-import": "^2.12.0",
    "eslint-plugin-react": "^7.8.2",
    "eslint-plugin-react-hooks": "^4.2.0",
    "postcss": "^8.4.18",
    "react-refresh": "^0.11.0",
    "stylelint": "9.3.0",
    "typescript": "^4.1.0",
    "webpack": "5.69.0"
  }
}

以下是针对性的排查和解决步骤:

  • 替换node-sass为sass(官方推荐)
    node-sass已停止维护,且对Node.js版本要求苛刻,node-sass@8.0.0大概率和当前环境存在兼容性冲突。
    执行命令替换:

    npm uninstall node-sass
    npm install sass --save-dev
    
  • 调整React版本适配Taro
    Taro 3.6.x对React 18的适配存在部分兼容性问题,暂时降级至React 17.x:
    修改package.json中的依赖:

    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "@types/react": "^17.0.0"
    

    执行npm install后重新运行项目。

  • 统一Taro依赖版本
    @tarojs/plugin-html使用了^3.6.2的版本范围,可能拉取了高于3.6.2的小版本,和其他固定版本的Taro依赖冲突。改为固定版本:

    "@tarojs/plugin-html": "3.6.2"
    
  • 升级@babel/runtime版本
    @babel/runtime@7.7.7版本过低,和@babel/core@7.8.0存在版本差,升级至匹配版本:

    "@babel/runtime": "^7.8.0"
    
  • 更新Stylelint版本
    stylelint@9.3.0过于老旧,不兼容postcss@8.4.18,执行命令更新:

    npm uninstall stylelint
    npm install stylelint@14.x --save-dev
    

    同步更新项目中的stylelint配置文件(若有)。

  • 检查Node.js版本
    Taro 3.6.2推荐使用Node.js 14.x-16.x,过高或过低的Node版本都可能导致依赖崩溃,可通过nvm切换版本后重试。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.26 15:25:01