Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ka2jun8 opened this issue Sep 8, 2020 · 25 comments · Fixed by #16934
Closed

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

ka2jun8 opened this issue Sep 8, 2020 · 25 comments · Fixed by #16934
Milestone

Comments

@ka2jun8
Copy link
Contributor

ka2jun8 commented Sep 8, 2020

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
    )
@ka2jun8
Copy link
Contributor Author

ka2jun8 commented Sep 14, 2020

Does anyone review it?

@vks-ahamilton
Copy link

Hi! I am having a similar bug setting up AMP first pages. Is there any resolve for this?

Error message: /xxx in .next/build-manifest.json
Here is what my build-manifest.json file looks like.
It seems that the AmpFirstPages isn't being populated properly...or at all
I would really love some help figuring this out please! Thank you!

amp2

amp

@ka2jun8
Copy link
Contributor Author

ka2jun8 commented Dec 19, 2020

@vks-ahamilton

Thanks for replying and some help.
I think it will be fixed if this PR is merged....

@kodiakhq kodiakhq bot closed this as completed in #16934 Dec 22, 2020
@Timer Timer modified the milestones: backlog, iteration 15 Dec 22, 2020
kodiakhq bot pushed a commit that referenced this issue Dec 22, 2020
Fixes: #16926

I do not know this is the right way.
Please review it.
@luiznasciment0
Copy link

luiznasciment0 commented Mar 29, 2021

I'm still having this problem.. what was the solution?
My log: Could not find files for /[slug] in .next/build-manifest.json

My Next.js version is 9.5.4

@ka2jun8
Copy link
Contributor Author

ka2jun8 commented Mar 30, 2021

@nicolasguasca1
Copy link

nicolasguasca1 commented Apr 8, 2021

Hello @ka2jun8 ! Myabe you know this one. I have next: 10.0.7 and this just popped up:

./src/components/header/index.tsx
Module not found: Can't resolve '/Users/app/node_modules/next/node_modules/@babel/runtime/helpers/esm/taggedTemplateLiteral' in '/Users/app/src/components/header'
Could not find files for / in .next/build-manifest.json
Could not find files for / in .next/build-manifest.json

Any solutions?

@ka2jun8
Copy link
Contributor Author

ka2jun8 commented Apr 8, 2021

@nicolasguasca1

Sorry, I did not know the solution.

I tried following operations again to reproduce your issue.
But I could not catch the error 'Could not find...'.
So I think it is not occurred by next.js 10.0.7.

  1. cd /vercel/next.js/examples/amp-first
  2. vi package.json # change next.js version to "10.0.7"
  3. npm i
  4. npm run build
  5. npm run start
  6. Go to 'localhost:3000'

How about removing .next and node_modules and try it again?

@nicolasguasca1
Copy link

Thank you! I did upgrade to next 10.1.3 remode node modules and yanr.lock. After that I did yarn install again and everything went well :)

@rcabre95
Copy link

rcabre95 commented Aug 9, 2021

I'm having this issue with next v11.0.1

@egemon
Copy link

egemon commented Aug 10, 2021

+1 with Next v11.0.1 and not only with AMP pages, but occasionally with any page in dev mode which is accessed for the first time.

@dalmo3
Copy link

dalmo3 commented Aug 11, 2021

+1 with Next v11.0.1 (...) occasionally with any page in dev mode which is accessed for the first time.

Same here.

@sivadinesh1
Copy link

+1 same here

@dotsinspace
Copy link

even now i am getting this for / wth is happening. did anyone found something.

Error:

Could not find files for / in .next/build-manifest.json

@MariSena331
Copy link

Same here
Could not find files for /xxx in .next/build-manifest.json

@vignesh-cloud-prog
Copy link

vignesh-cloud-prog commented Aug 25, 2021

Same here
Could not find files for /xxx in .next/build-manifest.json

Try ,
delete .next folder, again run server and Ctrl+Shift+R in Browser

@Manoj-nathwani
Copy link

Heads up - I've managed to fix this by updating webpack via

yarn add webpack --dev

@brayanL
Copy link

brayanL commented Sep 3, 2021

any solution? I'm using npm.

@IRediTOTO
Copy link

I'm having this issue with next v11.0.1

me too

@HumidBrains
Copy link

Me too, and not only on AMP pages.

@Zellerich
Copy link

Heads up - I've managed to fix this by updating webpack via

yarn add webpack --dev

This also worked for me.

@pavelspichonak
Copy link

Me too, and not only on AMP pages.

Same here. And also not only on AMP pages.

@magisters-cc
Copy link

Same.

@chulphan
Copy link

Anyone resolve this issue??
I'm using next11 and only occurred in development mode (but this issue was not occurred when using next10)

@margox
Copy link

margox commented Dec 26, 2021

me too! and I am using nextjs@^12.0.7,the js file of dynamic page (pages/articles/[id].jsx) was missing when I visit the page via http://localhost:3000/articles/123 directly, but when I redirect to this page via <Llink herf="/articles/123">, it works...

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.