GitHub 操作在 npm ci 上失败

标签 github npm github-actions npm-ci

我有 git 操作来运行 prettier(代码格式化程序)。下面是git Action 的format.yml文件。

name: Format code with prettier
on:
  push:
    branches-ignore:
      - master
jobs:
  format:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      # Install NPM dependencies, cache them correctly
      - name: Run prettier
        run: |
          npm ci
          npm run prettier-check

下面列出了我遇到的错误。

npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile 
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile 
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'react-lottie@1.2.3',
npm WARN EBADENGINE   required: { npm: '^3.0.0' },
npm WARN EBADENGINE   current: { node: 'v16.13.0', npm: '8.1.0' }
npm WARN EBADENGINE }
...
npm ERR! code 1
npm ERR! path /home/runner/work/Web/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /usr/local/bin/node /home/runner/work/Web/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! make: Entering directory '/home/runner/work/Web/node_modules/node-sass/build'
npm ERR!   g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DLIBSASS_VERSION="3.5.5"' -I/home/runner/.node-gyp/16.13.0/include/node -I/home/runner/.node-gyp/16.13.0/src -I/home/runner/.node-gyp/16.13.0/deps/openssl/config -I/home/runner/.node-gyp/16.13.0/deps/openssl/openssl/include -I/home/runner/.node-gyp/16.13.0/deps/uv/include -I/home/runner/.node-gyp/16.13.0/deps/zlib -I/home/runner/.node-gyp/16.13.0/deps/v8/include -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -std=gnu++14 -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/ast.cpp
...
npm ERR! gyp verb extracted file from tarball include/node/uv/os390.h
npm ERR! gyp verb extracted file from tarball include/node/uv/posix.h
npm ERR! gyp verb extracted file from tarball include/node/uv/stdint-msvc2008.h
npm ERR! gyp verb extracted file from tarball include/node/uv/sunos.h
npm ERR! gyp verb extracted file from tarball include/node/uv/threadpool.h
npm ERR! gyp verb extracted file from tarball include/node/uv/unix.h
npm ERR! gyp verb extracted file from tarball include/node/uv/win.h
npm ERR! gyp verb extracted file from tarball include/node/uv/errno.h
npm ERR! gyp verb extracted file from tarball include/node/uv/tree.h
npm ERR!
Error: Process completed with exit code 1.

Git 操作 yml 文件以前用来工作。我没有更改任何版本/包锁定文件。尽管如此,它还是失败了。谁能从错误日志中提出解决方案?

最佳答案

看来您在 githubAction 中运行了不同的节点版本。

在运行 npm ci 之前设置与本地相同的节点版本(例如 14):

- uses: actions/setup-node@v2
  with:
    node-version: '14'
- name: Run prettier
  run: |
    npm ci
    npm run prettier-check
...

关于GitHub 操作在 npm ci 上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70217629/

相关文章:

linux - 安装pm2出错

ios - `carthage bootstrap` 命令导致 Github Actions 工作流程中出现 `API rate limit exceeded` 错误

docker - 如何在Docker容器中运行VS Code的Extension Development Host来测试我的vscode扩展?

git - 如何转到git中的特定提交

node.js - 从不同的存储库运行 npm 脚本

java - 局部变量 user_input 从内部类内部访问;需要宣布最终

node.js - 如何在 Windows 7 上安装 Zombie JS? (node.js headless 浏览器)

Docker buildx 错误 : rpc error: code = Unknown desc = server message: insufficient_scope: authorization failed

linux - 使用 'git remote add origin' 创建一个全局远程而不是一个本地到当前目录/repo

github - Nuget Push 总是返回 404(未找到)