Next.js: Couldn't find a `pages` directory. Please create one under the project root

Created on 7 Jun 2017  路  7Comments  路  Source: vercel/next.js

I noticed that when I add files: [] in package.json, the following error appears:

Couldn't find a pages directory. Please create one under the project root

Is this a bug?

If not, it would be great to document this.

Most helpful comment

i have same issue using next.js in docker. how to resolve it ?

All 7 comments

This is not a bug. What's happening is your files are not included in the project.
See: https://docs.npmjs.com/files/package.json#files

So, use the files wisely or remove it.

I put files: [] intentionally there, as I was planning to publish some files to npm later.

Why is publishing to npm bound to publishing via now?

Ideally, I'd like to publish only a subset of all my app files to npm.

What if now checked nextFiles rather than files in package.json?

@moroshko Actually this is not a Next.js issue. Try asking it from the now repo(or from the channel) for more info.

i have same issue using next.js in docker. how to resolve it ?

Hello, i have the same problem. I run npm as user, the owner is me, next.js do not create folder dist.

Thx

@to-kra How did you solve it with Docker?

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

Was this page helpful?
0 / 5 - 0 ratings