继续运行工作流时,我不断收到以下错误:
Run npm test
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/runner/work/armoire/armoire/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/runner/work/armoire/armoire/package.json'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-11-12T17_08_44_277Z-debug.log
Error: Process completed with exit code 254.
yaml工作流程为:
name: frontendTesting
run-name: ${{ github.actor }} is testing her frontend
on: [push]
jobs:
check-bats-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
- run: npm install -g bats
- run: bats -v
run-unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
- run: cd frontend
- run: npm install
- run: npm test
我认为这个错误是因为我没有一个package.json,而.github/workflows是.我有两个文件夹:frontend和backend。它们各自的package.json文件都在那些文件夹里。我该怎么解决这个问题呢?提前谢谢!
1条答案
按热度按时间xxhby3vn1#
修复非常简单,只需重定向到package.json使用“工作目录”的位置-例如: