AWS codebuild 失败,并显示错误:- COMMAND_EXECUTION_ERROR:执行命令时出错:yarn run build。原因:退出状态1

发布于 2025-01-16 13:17:13 字数 1335 浏览 3 评论 0原文

我正在尝试使用 aws codebuild 来创建 ci/cd 管道。我使用纱线作为包管理器。这是我的构建规范文件。

# Do not change version. This is the version of aws buildspec, not the version of your buldspec file.
  version: 0.2
  phases:
    install:
      commands:
            - echo update npm...
            - npm install -g n
            - n latest
            - npm update -g npm
            - echo node -v
            - node -v
            - echo npm -v
            - npm -v
            - echo install yarn...
            - npm install -g yarn
            - echo yarn -v
            - yarn -v
    pre_build:
      commands:
        #installs dependencies into the node_modules/ directory
        - echo Entered the pre_build phase...
        - yarn install
    build:
      commands:
        - echo Build started on `date`
        - echo Compiling
        - yarn run build
    post_build:
      commands:
        - echo Build completed on `date`
  # Include only the files required for your application to run.
  artifacts:
    files:
      - public/**/*
      - src/**/*
      - package.json
      - appspec.yml
      - scripts/**/*

PS:由于某种原因,仅编写纱线在预构建阶段不起作用。但现在它在构建阶段显示错误。

COMMAND_EXECUTION_ERROR: Error while executing command: yarn run build. Reason: exit 
 status 1

由于我是 AWS 新手,我无法找到解决方案。如果可能的话,请帮助我。 谢谢

I am trying to aws codebuild for creating ci/cd pipeline. I have used yarn as package manager. Here is my buildspec file.

# Do not change version. This is the version of aws buildspec, not the version of your buldspec file.
  version: 0.2
  phases:
    install:
      commands:
            - echo update npm...
            - npm install -g n
            - n latest
            - npm update -g npm
            - echo node -v
            - node -v
            - echo npm -v
            - npm -v
            - echo install yarn...
            - npm install -g yarn
            - echo yarn -v
            - yarn -v
    pre_build:
      commands:
        #installs dependencies into the node_modules/ directory
        - echo Entered the pre_build phase...
        - yarn install
    build:
      commands:
        - echo Build started on `date`
        - echo Compiling
        - yarn run build
    post_build:
      commands:
        - echo Build completed on `date`
  # Include only the files required for your application to run.
  artifacts:
    files:
      - public/**/*
      - src/**/*
      - package.json
      - appspec.yml
      - scripts/**/*

PS: Here for some reason by writing only yarn is not working in prebuild phase. But now its showing error in build phase.

COMMAND_EXECUTION_ERROR: Error while executing command: yarn run build. Reason: exit 
 status 1

As I am new to aws I am unable to find solution. Please help me in this if possible.
Thank you

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文