Github操作构建应用程序时出现npm ENOENT错误

htrmnn0y  于 2022-11-24  发布在  Git
关注(0)|答案(1)|浏览(130)

我们已经为我们的Nuxt 3网站设置了一个部署过程,Github Action在尝试构建应用程序时出错。
错误:

> build
> nuxt build

npm ERR! code ENOENT
npm ERR! syscall spawn sh
npm ERR! path /home/***/work/my-website-repo-name/my-website-repo-name
npm ERR! errno -2
npm ERR! enoent spawn sh ENOENT
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/***/.npm/_logs/2022-11-21T11_35_50_456Z-debug-0.log
Error: Process completed with exit code 254.

下面是我们的yml文件:

name: CI

on:
  push:
    branches:
      - master

jobs:
  deploy:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3

      - name: Setup Node 16.x
        uses: actions/setup-node@v3
        with:
          node-version: 16.x

      - name: Install dependencies
        run: npm ci --ignore-scripts

      - name: Build server
        run: npm run build

      - name: Deploying
        uses: appleboy/scp-action@master
        with:
          host: ${{ secrets.HOST }}
          username: ${{ secrets.USERNAME }}
          password: ${{ secrets.PASSWORD }}
          source: ".output"
          target: ${{ secrets.PATH }}

在本地环境中构建应用程序时没有错误,我们也尝试设置相同的节点版本,但没有成功。

shyt4zoc

shyt4zoc1#

最后我总算找到了问题所在:如果我在最后一步中从目标中删除PATH密码,并用实际的服务器路径替换它,它就可以工作

相关问题