Reactjs 部署到DigitalOcean时GitHub操作失败

Reactjs 部署到DigitalOcean时GitHub操作失败,reactjs,docker,github-actions,Reactjs,Docker,Github Actions,我在试图通过github操作部署到DigitalOcean时遇到了一个错误,我不知道为什么它会大喊python。是因为我使用的docker图像吗?我尝试在droplet上安装python版本,尽管这可能与此无关 以下是相关的dockerfile: FROM node:alpine3.12 as build WORKDIR /usr/src/app COPY package*.json ./ RUN yarn cache clean && yarn --update-checks

我在试图通过github操作部署到DigitalOcean时遇到了一个错误,我不知道为什么它会大喊python。是因为我使用的docker图像吗?我尝试在droplet上安装python版本,尽管这可能与此无关

以下是相关的dockerfile:

FROM node:alpine3.12 as build

WORKDIR /usr/src/app
COPY package*.json ./
RUN yarn cache clean && yarn --update-checksums
COPY . ./
RUN yarn && yarn build

# Stage - Production
FROM nginx:1.17-alpine
COPY --from=build /usr/src/app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]
以下是操作的deploy.yml文件:

name: build

on:
  push:
    branches:
      - master

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Use Node.js 13.10
        uses: actions/setup-node@v1
        with:
          node-version: '13.10'
      - name: Install yarn and run unittest
        run: |
          yarn
          yarn test
        env:
          CI: true
      - name: Publish to Github Packages Registry
        uses: elgohr/Publish-Docker-Github-Action@master
        with:
          name: fanzypantz/onepole/onepole
          registry: docker.pkg.github.com
          username: ${{ secrets.USERNAME }}
          password: ${{ secrets.GITHUB_TOKEN }}
          dockerfile: Dockerfile-prod
          tags: latest
      - name: Deploy package to digitalocean
        uses: appleboy/ssh-action@master
        env:
          GITHUB_USERNAME: ${{ secrets.USERNAME }}
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          host: ${{ secrets.HOST }}
          username: ${{ secrets.USERNAME }}
          password: ${{ secrets.PASSWORD }}
          port: ${{ secrets.PORT }}
          envs: GITHUB_USERNAME, GITHUB_TOKEN
          script: |
            docker stop $(docker ps -a -q)
            docker login docker.pkg.github.com -u $GITHUB_USERNAME -p $GITHUB_TOKEN
            docker pull docker.pkg.github.com/fanzypantz/onepole/onepole:latest
            docker run -dit -p 80:80 docker.pkg.github.com/fanzypantz/onepole/onepole:latest
github操作出错

Step 1/10 : FROM node:alpine3.12 as build
alpine3.12: Pulling from library/node
188c0c94c7c5: Pulling fs layer
9e35e0178777: Pulling fs layer
90f5366a8ab8: Pulling fs layer
39095b5b3547: Pulling fs layer
39095b5b3547: Waiting
188c0c94c7c5: Verifying Checksum
188c0c94c7c5: Download complete
188c0c94c7c5: Pull complete
90f5366a8ab8: Download complete
9e35e0178777: Verifying Checksum
9e35e0178777: Download complete
39095b5b3547: Verifying Checksum
39095b5b3547: Download complete
9e35e0178777: Pull complete
90f5366a8ab8: Pull complete
39095b5b3547: Pull complete
Digest: sha256:96683bc4c05c2cb2c3bee957cdf7b967051323dafb937301d4b9fac30e529d7a
Status: Downloaded newer image for node:alpine3.12
 ---> 8f99f65ba94a
Step 2/10 : WORKDIR /usr/src/app
 ---> Running in 8fa7d7cacf45
Removing intermediate container 8fa7d7cacf45
 ---> 9d3dddf518f7
Step 3/10 : COPY package*.json ./
 ---> ee091cf8a93a
Step 4/10 : RUN yarn cache clean && yarn --update-checksums
 ---> Running in d03b8ed6e52a
yarn cache v1.***.5
success Cleared cache.
Done in 0.04s.
yarn install v1.***.5
info No lockfile found.
[1/4] Resolving packages...
warning @testing-library/jest-dom > css > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning @testing-library/jest-dom > css > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning @testing-library/jest-dom > css > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
warning @testing-library/react > @types/testing-library__react > @types/testing-library__dom@7.5.0: This is a stub types definition. testing-library__dom provides its own type definitions, so you do not need this installed.
warning node-sass > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning node-sass > node-gyp > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning node-sass > request > har-validator@5.1.5: this library is no longer supported
warning react-scripts > eslint-loader@3.0.3: This loader has been deprecated. Please use eslint-webpack-plugin
warning react-scripts > jest-environment-jsdom-fourteen > jsdom > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning react-scripts > webpack-dev-server > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning react-scripts > webpack-dev-server > chokidar > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning react-scripts > babel-jest > @jest/transform > jest-haste-map > fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning react-scripts > jest-environment-jsdom-fourteen > jsdom > request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/joi@15.1.1: joi is leaving the @hapi organization and moving back to 'joi' (https://github.com/sideway/joi/issues/2411)
warning react-scripts > webpack > watchpack > watchpack-chokidar2 > chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/topo > @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
warning react-scripts > workbox-webpack-plugin > workbox-build > @hapi/joi > @hapi/address@2.1.4: This version has been deprecated and is no longer supported or maintained
warning react-scripts > jest > jest-cli > jest-config > jest-environment-jsdom > jsdom > left-pad@1.3.0: use String.prototype.padStart()
warning react-scripts > workbox-webpack-plugin > workbox-build > strip-comments > babel-plugin-transform-object-rest-spread > babel-runtime > core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
[2/4] Fetching packages...
info fsevents@2.1.2: The platform "linux" is incompatible with this module.
info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.3: The platform "linux" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > @testing-library/user-event@7.2.1" has unmet peer dependency "@testing-library/dom@>=5".
warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
[4/4] Building fresh packages...
error /usr/src/app/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments: 
Directory: /usr/src/app/node_modules/node-sass
Output:
Building: /usr/local/bin/node /usr/src/app/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/usr/local/bin/node',
gyp verb cli   '/usr/src/app/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@15.0.0 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/usr/src/app/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/usr/src/app/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/usr/src/app/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /usr/src/app/node_modules/which/which.js:89:16
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:183:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/usr/src/app/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/usr/src/app/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/usr/src/app/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /usr/src/app/node_modules/which/which.js:89:16
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:183:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` failed Error: not found: python
gyp verb `which` failed     at getNotFoundError (/usr/src/app/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/usr/src/app/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/usr/src/app/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /usr/src/app/node_modules/which/which.js:89:16
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:183:21)
gyp verb `which` failed  python Error: not found: python
gyp verb `which` failed     at getNotFoundError (/usr/src/app/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/usr/src/app/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/usr/src/app/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /usr/src/app/node_modules/which/which.js:89:16
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /usr/src/app/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:183:21) {
gyp verb `which` failed   code: 'ENOENT'
gyp verb `which` failed }
gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/usr/src/app/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/usr/src/app/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/usr/src/app/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/usr/src/app/node_modules/which/which.js:80:29)
gyp ERR! stack     at /usr/src/app/node_modules/which/which.js:89:16
gyp ERR! stack     at /usr/src/app/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /usr/src/app/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:183:21)
gyp ERR! System Linux 5.4.0-1031-azure
gyp ERR! command "/usr/local/bin/node" "/usr/src/app/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /usr/src/app/node_modules/node-sass
gyp ERR! node -v v15.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
The command '/bin/sh -c yarn cache clean && yarn --update-checksums' returned a non-zero code: 1
步骤1/10:来自节点:alpine3.12生成时
alpine3.12:从库/节点拉出
188c0c94c7c5:牵引fs层
9e35e0178777:牵引fs层
90f5366a8ab8:牵引fs层
39095b5b3547:牵引fs层
39095b5b3547:正在等待
188c0c94c7c5:验证校验和
188c0c94c7c5:下载完成
188c0c94c7c5:拉动完成
90f5366a8ab8:下载完成
9e35e0178777:验证校验和
9e35e0178777:下载完成
39095b5b3547:验证校验和
39095b5b3547:下载完整
9e35e0178777:拉动完成
90f5366a8ab8:拉动完成
39095b5b3547:拉动完成
摘要:sha256:96683bc4c05c2cb2c3bee957cdf7b967051323dafb937301d4b9fac30e529d7a
状态:已下载节点的较新映像:alpine3.12
--->8f99f65ba94a
步骤2/10:WORKDIR/usr/src/app
--->在8fa7d7cacf45中运行
拆卸中间容器8fa7d7cacf45
--->9d3dddf518f7
步骤3/10:复制包*.json/
--->ee091cf8a93a
步骤4/10:运行纱线缓存清理和纱线-更新校验和
--->在d03b8ed6e52a中运行
纱线缓存v1.**.5
成功清除了缓存。
在0.04秒内完成。
纱线安装v1.**.5
信息找不到锁文件。
[1/4]正在解析包。。。
警告@testing library/jest dom>css>urix@0.1.0:请看https://github.com/lydell/urix#deprecated
警告@testing library/jest dom>css>source map resolve>urix@0.1.0:请看https://github.com/lydell/urix#deprecated
警告@testing library/jest dom>css>source map resolve>resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
警告@testing library/react>@types/testing-library\uuuu react>@types/testing library__dom@7.5.0:这是存根类型定义。testing-library\uu dom提供了自己的类型定义,因此您不需要安装它。
警告节点sass>request@2.88.2:请求已被否决,请参阅https://github.com/request/request/issues/3142
警告节点sass>节点gyp>request@2.88.2:请求已被否决,请参阅https://github.com/request/request/issues/3142
警告节点sass>请求>har-validator@5.1.5:不再支持此库
警告:反应脚本>eslint-loader@3.0.3:此加载程序已被弃用。请使用eslint网页包插件
警告反应脚本>jest环境jsdom十四>jsdom>request@2.88.2:请求已被否决,请参阅https://github.com/request/request/issues/3142
警告:反应脚本>网页包开发服务器>chokidar@2.1.8:Chokidar 2将在节点v14+上中断。升级到chokidar 3,依赖项减少15倍。
警告-反应脚本>网页包开发服务器>chokidar>fsevents@1.2.13:fsevents 1将在节点v14+上中断,并且可能使用不安全的二进制文件。升级至fsevents 2。
警告-反应脚本>巴别塔笑话>@jest/transform>笑话-快速地图>fsevents@1.2.13:fsevents 1将在节点v14+上中断,并且可能使用不安全的二进制文件。升级至fsevents 2。
警告-反应脚本>jest环境jsdom十四>jsdom>请求承诺-native@1.0.9:request promise native已弃用,因为它扩展了现在弃用的请求包,请参阅https://github.com/request/request/issues/3142
警告:反应脚本>工作盒网页包插件>工作盒构建>@hapi/joi@15.1.1:joi将离开@hapi组织并返回“joi”(https://github.com/sideway/joi/issues/2411)
警告-反应脚本>网页包>watchpack>watchpack-chokidar2>chokidar@2.1.8:Chokidar 2将在节点v14+上中断。升级到chokidar 3,依赖项减少15倍。
警告:反应脚本>jest>jest cli>jest配置>jest环境jsdom>jsdom>request@2.88.2:请求已被否决,请参阅https://github.com/request/request/issues/3142
警告-反应脚本>jest>jest cli>jest配置>jest环境jsdom>jsdom>请求承诺-native@1.0.9:request promise native已弃用,因为它扩展了现在弃用的请求包,请参阅https://github.com/request/request/issues/3142
警告:反应脚本>工作盒网页包插件>工作盒构建>@hapi/joi>@hapi/topo@3.1.6:此版本已被弃用,不再受支持或维护
警告:反应脚本>工作盒网页包插件>工作盒构建>@hapi/joi>@hapi/hoek@8.5.1:此版本已被弃用,不再受支持或维护
警告:反应脚本>工作盒网页包插件>工作盒构建>@hapi/joi>@hapi/topo>@hapi/hoek@8.5.1:此版本已被弃用,不再受支持或维护
警告:反应脚本>工作盒网页包插件>工作盒构建>@hapi/joi>@hapi/bourne@1.3.2:此版本已被弃用,不再受支持或维护
警告:反应脚本>工作盒网页包插件>工作盒构建>@hapi/joi>@hapi/address@2.1.4:此版本已被弃用,不再受支持或维护
警告:反应脚本>jest>jest cli>jest配置>jest环境jsdom>jsdom>左侧-pad@1.3.0:使用String.prototype.padStart()

警告-反应脚本>工作盒网页包插件>工作盒构建>条评论>babel插件转换对象rest spread>babel运行时>核心-js@2.6.11:core js@您在中有相同类型的错误,作为解决方案:

我和错误消失了

bundle更新webpacker
rails webpacker:binstubs
纱线升级@rails/webpacker——最新版本
纱线升级网页包开发服务器--最新版本
但这是因为,对于这个问题,链接步骤开始时的问题涉及
webpacker

在你的情况下,你看

[3/4]链接依赖项。。。
警告“>@测试库/用户-event@7.2.1“有unm吗
FROM node:14.13.1-slim as build

WORKDIR /usr/src/app
COPY package*.json ./
RUN yarn cache clean && yarn --update-checksums
COPY . ./
RUN yarn && yarn build

# Stage - Production
FROM nginx:1.18.0-alpine
COPY --from=build /usr/src/app/build /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]