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

Exception happened when export directory is named 'static' #20408

Closed
metrue opened this issue Dec 23, 2020 · 4 comments · Fixed by #20969
Closed

Exception happened when export directory is named 'static' #20408

metrue opened this issue Dec 23, 2020 · 4 comments · Fixed by #20969
Labels
good first issue Easy to fix issues, good for newcomers
Milestone

Comments

@metrue
Copy link

metrue commented Dec 23, 2020

Bug report

Describe the bug

Could not export output into a directory named static

To Reproduce

Go to your nextjs project, then mkdir static and next build && next export -o static

npm run build

> learn-starter@0.1.0 build /Users/minhuang/projects/giki/nextjs-blog
> next build && next export -o static

info  - Creating an optimized production build  
info  - Compiled successfully
info  - Collecting page data  
info  - Generating static pages (3/3)
info  - Finalizing page optimization  

Page                                                           Size     First Load JS
┌ ○ /                                                          10.4 kB        81.2 kB
├   └ css/66da66fb2c34490d64fa.css                             1.79 kB
├   /_app                                                      0 B            70.9 kB
├ ○ /404                                                       2.75 kB        73.6 kB
└ ○ /posts/first-post                                          1.63 kB        72.5 kB
+ First Load JS shared by all                                  70.9 kB
  ├ chunks/71247caf95475e3ea7f9a0f8a30beb258b23d005.bd1365.js  6.57 kB
  ├ chunks/commons.93a9e8.js                                   3.2 kB
  ├ chunks/fad5b6fe3657428a9611bc5c5609d8f456c75c77.5d8831.js  10.3 kB
  ├ chunks/framework.9ec1f7.js                                 39.9 kB
  ├ chunks/main.6fd8c3.js                                      6.23 kB
  ├ chunks/pages/_app.ca2459.js                                3.92 kB
  ├ chunks/webpack.e06743.js                                   751 B
  └ css/7ef9bd81cf95a32cd30e.css                               1.14 kB

λ  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
○  (Static)  automatically rendered as static HTML (uses no initial props)
●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
   (ISR)     incremental static regeneration (uses revalidate in getStaticProps)

info  - using build directory: /Users/minhuang/projects/giki/nextjs-blog/build
info  - Copying "static" directory
[Error: ENAMETOOLONG: name too long, mkdir '/Users/minhuang/projects/giki/nextjs-blog/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static'] {
  errno: -63,
  code: 'ENAMETOOLONG',
  syscall: 'mkdir',
  path: '/Users/minhuang/projects/giki/nextjs-blog/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static/static'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! learn-starter@0.1.0 build: `next build && next export -o static`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the learn-starter@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/minhuang/.npm/_logs/2020-12-23T00_19_41_678Z-debug.log

Expected behavior

All static files should be generated in /static directory.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

$ uname -a
Darwin FVFXG11WHV2J 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64

Additional context

Add any other context about the problem here.

@metrue metrue added the bug Issue was opened via the bug report template. label Dec 23, 2020
@Maxgit3
Copy link

Maxgit3 commented Dec 24, 2020

https://nextjs.org/docs/basic-features/static-file-serving

I think all static files have to be in a directory named public

@timneutkens timneutkens added good first issue Easy to fix issues, good for newcomers kind: bug and removed bug Issue was opened via the bug report template. labels Jan 3, 2021
@timneutkens timneutkens added this to the backlog milestone Jan 3, 2021
@timneutkens
Copy link
Member

Feel free to send a PR disallowing -o being static or public.

@metrue

This comment has been minimized.

@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 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Easy to fix issues, good for newcomers
Projects
None yet
5 participants