Действия Github - / bin / sh: 1: jest: не найдено - PullRequest
2 голосов
/ 28 апреля 2020

Использование действий Github для публикации sh npm пакета. Работает и запускает тестовые примеры без ошибок. Поэтому я решил добавить кэш пряжи для оптимизации времени сборки, и процесс кеширования работает, но шутка завершается с ошибкой ниже.

$ jest --config=jest.config.js
/bin/sh: 1: jest: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
##[error]Process completed with exit code 127.

Вот мой yml

name: NPM Publish
on:
  push:
    branches: 
      - master

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: 12.x

      - name: Get yarn cache directory
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn cache dir)"

      - uses: actions/cache@v1
        id: yarn-cache
        with:
          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-yarn-

      - name: Install dependencies
        if: steps.yarn-cache.outputs.cache-hit != 'true'
        run: yarn install --frozen-lockfile

      - name: Test cases
        run: yarn run pdn:test

1 Ответ

0 голосов
/ 30 апреля 2020

У меня была похожая проблема, и я немного рассказал о том, что делают другие. Может быть, дать этому шанс

- name: Cache dependencies
  uses: actions/cache@v1
  id: yarn-cache
  with:
    path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
    key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
    restore-keys: |
      ${{ runner.os }}-yarn-
- name: Install Dependencies (from network)
  if: steps.cache-deps.outputs.cache-hit != 'true'
  run: |
    yarn policies set-version
    yarn install --frozen-lockfile --ignore-optional
- name: Install Dependencies (from cache)
  if: steps.cache-deps.outputs.cache-hit == 'true'
  run: |
    yarn policies set-version
    yarn install --frozen-lockfile --ignore-optional --offline
...