CircleCI (Started 11/1/2021) Can't find Python executable "python", you can set the PYTHON env variable

CircleCI (Started 11/1/2021) Can’t find Python executable “python”, you can set the PYTHON env variable

截至今天早上,CircleCI 因这个奇怪的构建错误而失败:

Can't find Python executable "python", you can set the PYTHON env variable

我在新提交时注意到了它。当然,我认为这是我的新提交,所以我强行将我最后一次已知的提交提交推到了主分支上。

特别是,这对我来说似乎是今天早上 (11 月 1 日) 开始的,并且构建现在在 16 小时前通过的同一个提交上失败了(这不是很有趣)

完整的错误是:

#!/bin/bash -eo pipefail
if [ ! -f "package.json" ]; then
  echo
  echo "---"
  echo "Unable to find your package.json file. Did you forget to set the app-dir parameter?"
  echo "---"
  echo
  echo "Current directory: $(pwd)"
  echo
  echo
  echo "List directory: "
  echo
  ls
  exit 1
fi
case yarn in
  npm)
    if [[ "false" == "true" ]]; then
      npm install
    else
      npm ci
    fi
  ;;
  yarn)
    if [[ "false" == "true" ]]; then
      yarn install
    else
      yarn install --frozen-lockfile
    fi
  ;;
esac

yarn install v1.22.15
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@2.3.2: The platform "linux" is incompatible with this module.
info "fsevents@2.3.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.
[3/4] Linking dependencies...
warning " > @babel/preset-react@7.13.13" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@babel/preset-react > @babel/plugin-transform-react-display-name@7.14.2" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@babel/preset-react > @babel/plugin-transform-react-jsx@7.13.12" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@babel/preset-react > @babel/plugin-transform-react-jsx-development@7.12.17" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@babel/preset-react > @babel/plugin-transform-react-pure-annotations@7.12.1" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@babel/preset-react > @babel/plugin-transform-react-jsx > @babel/plugin-syntax-jsx@7.12.13" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > @reactchartjs/react-chart.js@1.0.0-rc.4" has incorrect peer dependency "chart.js@^2.3".
warning " > styled-components@5.3.0" has unmet peer dependency "react-is@>= 16.8.0".
warning " > webpack-dev-server@3.11.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning "webpack-dev-server > webpack-dev-middleware@3.7.3" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
[4/4] Building fresh packages...
error /home/circleci/project/node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments: 
Directory: /home/circleci/project/node_modules/node-sass
Output:
Building: /usr/local/bin/node /home/circleci/project/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   '/home/circleci/project/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@16.13.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 (/home/circleci/project/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/home/circleci/project/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/home/circleci/project/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /home/circleci/project/node_modules/which/which.js:89:16
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21)
gyp verb `which` failed  python2 Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/home/circleci/project/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/home/circleci/project/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/home/circleci/project/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /home/circleci/project/node_modules/which/which.js:89:16
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198: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 (/home/circleci/project/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/home/circleci/project/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/home/circleci/project/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /home/circleci/project/node_modules/which/which.js:89:16
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198:21)
gyp verb `which` failed  python Error: not found: python
gyp verb `which` failed     at getNotFoundError (/home/circleci/project/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/home/circleci/project/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/home/circleci/project/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /home/circleci/project/node_modules/which/which.js:89:16
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /home/circleci/project/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:198: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 (/home/circleci/project/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/home/circleci/project/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/home/circleci/project/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/home/circleci/project/node_modules/which/which.js:80:29)
gyp ERR! stack     at /home/circleci/project/node_modules/which/which.js:89:16
gyp ERR! stack     at /home/circleci/project/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /home/circleci/project/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqCallback.oncomplete (node:fs:198:21)
gyp ERR! System Linux 4.15.0-1110-aws
gyp ERR! command "/usr/local/bin/node" "/home/circleci/project/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/circleci/project/node_modules/node-sass
gyp ERR! node -v v16.13.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.

Exited with code exit status 1
CircleCI received exit code 1

我的 circleci 配置文件(未更改)是:

version: 2.1 # Use 2.1 to enable using orbs and other features.

# Declare the orbs that we'll use in our config.
# read more about orbs: https://circleci.com/docs/2.0/using-orbs/
orbs:
  ruby: circleci/ruby@1.0
  node: circleci/node@2

jobs:
  build: # our first job, named "build"
    docker:
      - image: circleci/ruby:2.7.4-node-browsers # use a tailored CircleCI docker image.
        auth:
          username: mydockerhub-user
          password: $DOCKERHUB_PASSWORD  # context / project UI env-var reference
    steps:
      - checkout # pull down our git code.
      - ruby/install-deps # use the ruby orb to install dependencies
      # use the node orb to install our packages
      # specifying that we use `yarn` and to cache dependencies with `yarn.lock`
      # learn more: https://circleci.com/docs/2.0/caching/
      - node/install-packages:
          pkg-manager: yarn
          cache-key: "yarn.lock"

  test:  # our next job, called "test"


尝试使用下一代 Ruby 图像。在您的情况下,将 circleci/ruby:2.7.4-node-browsers 更改为 cimg/ruby:2.7.4-browsers。您可以找到完整的图像列表 here