question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AMP First Pages: Could not find files for /xxx in .next/build-manifest.json

See original GitHub issue

Bug report

Describe the bug

When AMP first pages are accessed, the following error statement outputs. Could not find files for /xxx in .next/build-manifest.json.

These AMP pages can be viewed.

To Reproduce

  1. cd /zeit/next.js/examples/amp-first
  2. npm i
  3. npm run build
  4. npm run start
  5. Go to ‘localhost:3000’
  6. See following error in your console
> next start

ready - started server on http://localhost:3000
Could not find files for / in .next/build-manifest.json

Expected behavior

No error outputs.

Screenshots

None.

System information

  • OS: macOS
  • Browser (if applies) Chrome
  • Version of Next.js: v9.5.3
  • Version of Node.js: v13.14.0

Additional context

This error will be called in getPageFiles here. getPageFiles will be called in getDocumentFiles here. getDocumentFiles is called when rendering all pages that use _document. So all pages might pass this function.

But I found that AMP First Pages was not included in build-manifest.json’s pages (PR). And, when AMPState ampFirst is true, the amp page files were excluded by render.tsx. However, This PR seems to be removed that feature and caused the error.

It may be roughly solved the following way in _document.tsx.

before:

    const files: DocumentFiles = getDocumentFiles(
      this.context.buildManifest,
      this.context.__NEXT_DATA__.page
    )

after:

    const files: DocumentFiles = inAmpMode ? {
      sharedFiles: [],
      pageFiles: [],
      allFiles: [],
    } : getDocumentFiles(
      this.context.buildManifest,
      this.context.__NEXT_DATA__.page
    )

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:7
  • Comments:25 (5 by maintainers)

github_iconTop GitHub Comments

17reactions
rcabre95commented, Aug 9, 2021

I’m having this issue with next v11.0.1

8reactions
ka2jun8commented, Sep 14, 2020

Does anyone review it?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dec 28, 2020
Anybody has/had this error Could not find files for /xxx in .next/build-manifest.json using #nextjs ?? it only happens on after building the ...
Read more >
Error: EACCES: permission denied - node.js
If I run it with sudo, it gets installed inside ~/node_modules folder. drwxrwxr-x is the file permission of existing folder. I can't figure...
Read more >
angular/angular - Gitter
We're using lazy loading and webpack. What appears to be happening is that the call to load the first lazy-loaded module are failing...
Read more >
make app from next js Code Example
E: The repository 'http://ppa.launchpad.net/certbot/certbot/ubuntu hirsute Release' does not have a Release file. ... You are running `create- ...
Read more >
UForge AppCenter User Documentation
Using an appliance template, the user can generate machine images in ... When you log in to the UForge Portal, the first page...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found