0

我在 Github 工作流程中运行纱线,但找不到 js-yaml。依赖项在我的 package.json 和 yarn.lock 中。我尝试在运行纱线之前明确添加它。我尝试了许多变体,例如

yarn install
yarn add js-yaml

日志输出看起来像是找到了模块,但是当我的 javascript 启动时我得到 Module not found :

yarn add v1.22.17
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 2 new dependencies.
info Direct dependencies
└─ js-yaml@4.1.0
info All dependencies
├─ argparse@2.0.1
└─ js-yaml@4.1.0
Done in 4.66s.
yarn install v1.22.17
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.13s.
internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'js-yaml'
Require stack:
- /home/runner/work/legible/legible/.github/workflows/per_stack_setup/per_stack_env_init.js

由于其他限制,我的工作流程代码总结如下:

    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Use Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 14.x

      - name: per stack setup
        working-directory: scripts
        run: |
          yarn add js-yaml --ignore-workspace-root-check
          yarn install
          node ../.github/workflows/per_stack_setup/per_stack_env_init.js
4

0 回答 0