柏树github动作在运行期间丢下错误

发布于 2025-02-07 05:21:10 字数 3305 浏览 1 评论 0原文

我正在尝试设置一个简单的柏树github操作,该操作测试被推到每个分支的代码以及在合并之前。但是我似乎每次都会遇到错误。我不知道它是否与柏树/io/github-action@v2使用的节点版本有关,无论我做什么,它都会不断丢弃此错误。以下是我项目的相关文件。

package.json

{
  "name": "crossa-frontend",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@stitches/react": "^1.2.8",
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^13.0.0",
    "@testing-library/user-event": "^13.2.1",
    "@types/jest": "^27.0.1",
    "@types/node": "^16.7.13",
    "@types/react": "^18.0.0",
    "@types/react-dom": "^18.0.0",
    "apisauce": "^2.1.5",
    "axios": "^0.27.2",
    "axios-retry": "^3.2.5",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "5.0.0",
    "typescript": "^4.4.2",
    "web-vitals": "^2.1.0"
  },
  "scripts": {
    "docker:build-image-staging": "docker-compose build --no-cache staging",
    "docker:build-image-prod": "docker-compose build --no-cache prod",
    "docker:staging": "docker-compose up staging",
    "docker:prod": "docker-compose up prod",
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "storybook": "start-storybook -p 6006 -s public",
    "build-storybook": "build-storybook -s public",
    "cypress:open": "cypress open",
    "cypress:run": "cypress run"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest",
      "plugin:cypress/recommended"
    ],
    "overrides": [
      {
        "files": [
          "**/*.stories.*"
        ],
        "rules": {
          "import/no-anonymous-default-export": "off"
        }
      }
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@storybook/addon-a11y": "^6.4.19",
    "@storybook/addon-actions": "^6.4.19",
    "@storybook/addon-essentials": "^6.4.19",
    "@storybook/addon-interactions": "^6.4.19",
    "@storybook/addon-links": "^6.4.19",
    "@storybook/builder-webpack5": "^6.4.19",
    "@storybook/manager-webpack5": "^6.4.19",
    "@storybook/node-logger": "^6.4.19",
    "@storybook/preset-create-react-app": "^4.1.0",
    "@storybook/react": "^6.4.19",
    "@storybook/testing-library": "0.0.9",
    "cypress": "^10.1.0",
    "eslint-plugin-cypress": "^2.12.1",
    "webpack": "^5.70.0"
  }
}

cypress.yml

name: Cypress Tests
on:
  push:
    branches:
      - dev
      - staging
      - prod
    pull_request:
jobs:
  cypress-run:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Cypress run
        uses: cypress-io/github-action@v2
        with:
          build: npm run build
          start: npm start

这是github动作上的错误

”在此处输入图像描述

如果有人使用最新的React版本进行此操作,请帮助我。

I am trying to set up a simple Cypress Github action that tests the code being pushed to each branch and also before it's merged. But I seem to be getting an error every time. I don't know if it has to do with the node version used by cypress-io/github-action@v2, no matter what I do, it keeps throwing this error. Below are my related files from my project.

package.json

{
  "name": "crossa-frontend",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@stitches/react": "^1.2.8",
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^13.0.0",
    "@testing-library/user-event": "^13.2.1",
    "@types/jest": "^27.0.1",
    "@types/node": "^16.7.13",
    "@types/react": "^18.0.0",
    "@types/react-dom": "^18.0.0",
    "apisauce": "^2.1.5",
    "axios": "^0.27.2",
    "axios-retry": "^3.2.5",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "5.0.0",
    "typescript": "^4.4.2",
    "web-vitals": "^2.1.0"
  },
  "scripts": {
    "docker:build-image-staging": "docker-compose build --no-cache staging",
    "docker:build-image-prod": "docker-compose build --no-cache prod",
    "docker:staging": "docker-compose up staging",
    "docker:prod": "docker-compose up prod",
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "storybook": "start-storybook -p 6006 -s public",
    "build-storybook": "build-storybook -s public",
    "cypress:open": "cypress open",
    "cypress:run": "cypress run"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest",
      "plugin:cypress/recommended"
    ],
    "overrides": [
      {
        "files": [
          "**/*.stories.*"
        ],
        "rules": {
          "import/no-anonymous-default-export": "off"
        }
      }
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  },
  "devDependencies": {
    "@storybook/addon-a11y": "^6.4.19",
    "@storybook/addon-actions": "^6.4.19",
    "@storybook/addon-essentials": "^6.4.19",
    "@storybook/addon-interactions": "^6.4.19",
    "@storybook/addon-links": "^6.4.19",
    "@storybook/builder-webpack5": "^6.4.19",
    "@storybook/manager-webpack5": "^6.4.19",
    "@storybook/node-logger": "^6.4.19",
    "@storybook/preset-create-react-app": "^4.1.0",
    "@storybook/react": "^6.4.19",
    "@storybook/testing-library": "0.0.9",
    "cypress": "^10.1.0",
    "eslint-plugin-cypress": "^2.12.1",
    "webpack": "^5.70.0"
  }
}

cypress.yml

name: Cypress Tests
on:
  push:
    branches:
      - dev
      - staging
      - prod
    pull_request:
jobs:
  cypress-run:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Cypress run
        uses: cypress-io/github-action@v2
        with:
          build: npm run build
          start: npm start

Here is the error on Github Actions
enter image description here

enter image description here

Please if anyone has done this with the latest react release, please help me out.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

赏烟花じ飞满天 2025-02-14 05:21:10

尝试在您的运行中添加“ - Legacy-Peer-Deps”:

    name: Cypress Tests
on:
push:
branches:
- dev
- staging
- prod
pull_request:
jobs:
cypress-run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install dependencies

try to add "--legacy-peer-deps" to your run:

    name: Cypress Tests
on:
  push:
    branches:
      - dev
      - staging
      - prod
    pull_request:
jobs:
  cypress-run:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Install dependencies ????
        run: npm ci --legacy-peer-deps
      - name: Show Cypress information ℹ️
        run: npx cypress info
      - name: Verify Cypress can run ????‍♂️
        run: npx cypress verify
      - name: Cypress run
        uses: cypress-io/github-action@v2
        with:
          build: npm run build
          start: npm start
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文