命令失败,退出代码 134:npm run generate

Posted

技术标签:

【中文标题】命令失败,退出代码 134:npm run generate【英文标题】:Command failed with exit code 134: npm run generate 【发布时间】:2021-12-23 19:19:06 【问题描述】:

我正在尝试将我的 nuxt js 项目部署到 netlify。安装部分工作正常,但在构建过程中返回错误。

我试图搜索谷歌,但我找不到任何解决这个问题的方法。

我也试过这个命令CI= npm run generate

3:16:42 PM: $ npm run generate
3:16:43 PM: > portfolio@1.0.0 generate
3:16:43 PM: > nuxt generate
3:16:50 PM: node: ../src/coroutine.cc:134: void* find_thread_id_key(void*): Assertion `thread_id_key != 0x7777' failed.
Aborted
3:16:50 PM: ​
3:16:50 PM: ────────────────────────────────────────────────────────────────
3:16:50 PM:   "build.command" failed                                        
3:16:50 PM: ────────────────────────────────────────────────────────────────
3:16:50 PM: ​
3:16:50 PM:   Error message
3:16:50 PM:   Command failed with exit code 134: npm run generate
3:16:50 PM: ​
3:16:50 PM:   Error location
3:16:50 PM:   In Build command from Netlify app:
3:16:50 PM:   npm run generate
3:16:50 PM: ​
3:16:50 PM:   Resolved config
3:16:50 PM:   build:
3:16:50 PM:     command: npm run generate
3:16:50 PM:     commandOrigin: ui
3:16:50 PM:     publish: /opt/build/repo/dist
3:16:50 PM:     publishOrigin: ui
3:16:50 PM: Caching artifacts
3:16:50 PM: Started saving node modules
3:16:50 PM: Finished saving node modules
3:16:50 PM: Started saving build plugins
3:16:50 PM: Finished saving build plugins
3:16:50 PM: Started saving pip cache
3:16:50 PM: Finished saving pip cache
3:16:50 PM: Started saving emacs cask dependencies
3:16:50 PM: Finished saving emacs cask dependencies
3:16:50 PM: Started saving maven dependencies
3:16:50 PM: Finished saving maven dependencies
3:16:50 PM: Started saving boot dependencies
3:16:50 PM: Finished saving boot dependencies
3:16:50 PM: Started saving rust rustup cache
3:16:50 PM: Finished saving rust rustup cache
3:16:50 PM: Started saving go dependencies
3:16:50 PM: Finished saving go dependencies
3:16:52 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
3:16:52 PM: Creating deploy upload records
3:16:52 PM: Failing build: Failed to build site
3:16:52 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
3:16:52 PM: Finished processing build request in 1m34.230804646s

这是 Nuxt 配置 - 我的目标是建立一个静态网站。你可能猜到这是我的投资组合网站。我正在研究我的投资组合以获得更好的工作。

nuxt.config.js

export default 
  // Target: https://go.nuxtjs.dev/config-target
  target: 'static',

  // Global page headers: https://go.nuxtjs.dev/config-head
  head: 
    title: 'Hasibur',
    htmlAttrs: 
      lang: 'en'
    ,
    meta: [
       charset: 'utf-8' ,
       name: 'viewport', content: 'width=device-width, initial-scale=1' ,
       hid: 'description', name: 'description', content: '' ,
       name: 'format-detection', content: 'telephone=no' 
    ],
    link: [
       rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' 
    ]
  ,

  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
    '@/assets/scss/main.scss'
  ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
     src: '~/plugins/components.js', mode: 'client' ,
     src: '~/plugins/fontawesome.js', mode: 'client' ,
  ],

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
    // https://go.nuxtjs.dev/tailwindcss
    '@nuxtjs/tailwindcss',
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    // https://go.nuxtjs.dev/axios
    '@nuxtjs/axios',
  ],

  // Axios module configuration: https://go.nuxtjs.dev/config-axios
  axios: ,

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: 
  


【问题讨论】:

它在本地工作吗?另外,你能分享你的nuxt.config.js 文件吗?还有,你知道coroutine.cc是什么吗? 是的,它在本地运行得很好。而且我不知道这个文件coroutine.cc 如果您生成项目,然后将您的/dist 目录上传到 app.netlify.com/drop? 问题是“纤维”。谢谢 【参考方案1】:

感谢this question,我刚刚遇到了同样的问题并解决了。问题似乎是fibers。

我修复它的步骤:

    卸载光纤:npm uninstall fibers 删除package-lock.json & node_modules/ 再次安装包:npm install

仅仅从 package.json 中移除纤程是不够的,因为 Netlify 似乎仍然可以在 package-lock.json 中找到包。

【讨论】:

但我必须使用光纤,因为我使用的是sasssass-loader。 Nuxt 需要使用fibers 时需要sass Nuxt 不需要它,他们只是推荐它,因为它缩短了构建时间。当您现在查看文档时,它们实际上是don't mention it anymore。

以上是关于命令失败,退出代码 134:npm run generate的主要内容,如果未能解决你的问题,请参考以下文章

执行命令时代码构建失败并出现错误:npm install。原因:退出状态 127

NG 构建在 Azure Pipelines 中失败,并出现 NPM 错误 134

错误:命令“npm run build”以 1 退出。vercel deploy 错误与 next.js

google-toolbox-for-mac iphone 单元测试:1073 中止陷阱 mkdir "$CFFIXED_USER_HOME" 命令 /bin/sh 失败,退出代码

(React Native) npm run ios 出错,构建命令失败:PhaseScriptExecution

React npm run build 每次都失败