首页 > 解决方案 > 反应应用程序的circleci和heroku问题

问题描述

我的 CI/CD 是:git > cicleci > heroku

我正在使用circleci的建议配置(附在下面)

我在circleci中有正确的环境变量。

第一部分运行良好,但是,当我部署到 heroku 时,我可以看到来自开发人员依赖项的警告,例如:

./src/hooks/myHook.js Line 11: React Hook useEffect has a missing dependency: 'x'. Either include it or remove the dependency array react-hooks/exhaustive-deps

这让我觉得 React dev 正在运行。

谁能帮我?

version: 2
jobs:
  build:
    ...
  deploy:
    docker:
      - image: buildpack-deps:trusty
    steps:
      - checkout
      - run:
          name: Deploy Master to Heroku
          command: |
            git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git master

workflows:
  version: 2
  build-deploy:
    jobs:
      - build
      - deploy:
          requires:
            - build
          filters:
            branches:
              only: master

标签: herokucirclecicircleci-2.0

解决方案


我不确定您是否已经使用了,但我强烈建议您使用这个 Heroku buildpack 而不是标准的 Heroku Node buildpack:https ://github.com/mars/create-react-app-buildpack 。默认情况下,此 buildpack 在生产中启动。

在 Heroku 中,转到 settings > Buildpacks 并单击 Add buildpack,然后输入以下 url:https://github.com/mars/create-react-app-buildpack.git并保存。

但是,如果出现上述挂钩错误,我会通过将其添加到挂钩中的依赖数组中来解决该问题。


推荐阅读