Git 操作在 npm ci 上失敗

尼迪達迪亞

我有 git action 來運行更漂亮的(代碼格式化程序)。下面是format.ymlgit action文件。

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: '[email protected]',
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.

yml以前工作過的Git 操作文件。我沒有更改任何版本/包鎖定文件。儘管如此,它還是失敗了。任何人都可以從錯誤日誌中提出解決方案嗎?

漢斯·費利克斯·拉莫斯

您似乎在 githubAction 中運行了不同的節點版本。

在運行之前設置與您使用本地(例如 14)相同的節點版本npm ci

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

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章