Действие GitHub завершается ошибкой в npm ci

#github #npm #github-actions #npm-ci

#github #нпм #github-действия #npm-ci

Вопрос:

У меня есть действие git для запуска красивее(форматирование кода). Ниже format.yml приведен файл действия git.

 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.  

yml Файл действий Git раньше работал. Я не изменил ни один файл блокировки версии/пакета. И все же он терпит неудачу. Может ли кто-нибудь предложить решение из журнала ошибок?

Ответ №1:

Похоже, вы используете другую версию узла в своем githubAction.

Настройте ту же версию узла, которую вы используете локально(например, 14), перед запуском npm ci :

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