Skip to content
This repository was archived by the owner on May 10, 2021. It is now read-only.
This repository was archived by the owner on May 10, 2021. It is now read-only.

Error when copying .next/static/ #102

Closed
@ehmicky

Description

@ehmicky

The following build fails with:

────────────────────────────────────────────────────────────────
  Plugin "@netlify/plugin-nextjs" internal error                
────────────────────────────────────────────────────────────────

  Error message
  Error: ENOENT: no such file or directory, stat '.next/static'

  Plugin details
  Package:        @netlify/plugin-nextjs
  Version:        1.0.2
  Repository:     git+https://github.com/netlify/netlify-plugin-nextjs.git
  npm link:       https://www.npmjs.com/package/@netlify/plugin-nextjs
  Report issues:  https://github.com/netlify/netlify-plugin-nextjs/issues

  Error location
  In "onBuild" event in "@netlify/plugin-nextjs" from Netlify app
      at Object.statSync (fs.js:933:3)
      at Object.statSync (/opt/buildhome/.netlify-build-plugins/node_modules/graceful-fs/polyfills.js:307:34)
      at statSync (/opt/buildhome/.netlify-build-plugins/node_modules/fs-extra/lib/util/stat.js:10:52)
      at getStatsSync (/opt/buildhome/.netlify-build-plugins/node_modules/fs-extra/lib/util/stat.js:24:19)
      at Object.checkPathsSync (/opt/buildhome/.netlify-build-plugins/node_modules/fs-extra/lib/util/stat.js:49:33)
      at copySync (/opt/buildhome/.netlify-build-plugins/node_modules/fs-extra/lib/copy-sync/copy-sync.js:24:38)
      at copyNextAssets (/opt/buildhome/.netlify-build-plugins/node_modules/next-on-netlify/lib/steps/copyNextAssets.js:10:3)
      at nextOnNetlify (/opt/buildhome/.netlify-build-plugins/node_modules/next-on-netlify/index.js:25:3)
      at onBuild (/opt/buildhome/.netlify-build-plugins/node_modules/@netlify/plugin-nextjs/index.js:78:5)
      at async Object.run (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/run.js:19:3)

The problem seems to be there:

join(NEXT_DIST_DIR, "static"),

This specific build does not have a .next/static/ directory, so trying to copy it fails.
I am not sure whether this is valid for .next/static/ not to exist. If it is valid, then this function should not copy anything if .next/static/ does not exist. If it is not valid, this function should throw with an error indicating the site has some configuration issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions