简体   繁体   English

为什么在build next.js项目的时候会报错?

[英]Why is there an error during build next.js project?

**my node.js.yml file ** **我的 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 error here在此处输入图片描述错误

link to my repository https://github.com/EduardKop/web-cv-next链接到我的存储库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

i wrote next.config.js config.我写了 next.config.js 配置。 I made a commit, then set up the action as indicated above in the yaml file and got an error我做了一个提交,然后在 yaml 文件中设置了上面指示的操作并得到了一个错误

You should give the path of images, in error says that path can't be less that 0 char.你应该给出图像的路径,错误的说路径不能小于 0 个字符。

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

module.exports = nextConfig

You should write path in path attribute.您应该在路径属性中写入路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM