为什么在构建next.js项目时出现错误?

fdx2calv  于 2023-05-17  发布在  其他
关注(0)|答案(1)|浏览(186)

我的node.js.yml文件

name: Node.js CI

on:
  push:
    branches: [ "main" ]
  pull_request:
    branches: [ "main" ]

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [14.x]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
    - uses: actions/checkout@v3
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v3
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'
    - run: npm ci
    - run: npm run build
    - run: npm run export
    
    - name: Deploy 🚀
      uses: JamesIves/github-pages-deploy-action@v4
      with:
          branch: gh-pages
          folder: out # The folder the action should deploy.

enter image description here此处出错
链接到我的存储库https://github.com/EduardKop/web-cv-next

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  distDir: 'build',
  images: {
    loader: 'akamai',
    path: '',
  }
  
}

module.exports = nextConfig

我写了next.config.js配置。我进行了一次提交,然后按照上面在yaml文件中指出的那样设置了操作,然后得到了一个错误

kq0g1dla

kq0g1dla1#

你应该给予图像的路径,在错误中说路径不能小于0字符。

/** @type {import('next').NextConfig} */
const nextConfig = {
  reactStrictMode: true,
  swcMinify: true,
  distDir: 'build',
  images: {
    loader: 'akamai',
    path: '',
  }
  
}

module.exports = nextConfig

应该在path属性中写入path。

相关问题