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

Error with yarn build with Next 14 #970

Closed
5 tasks done
geberele opened this issue Feb 22, 2024 · 3 comments
Closed
5 tasks done

Error with yarn build with Next 14 #970

geberele opened this issue Feb 22, 2024 · 3 comments

Comments

@geberele
Copy link

geberele commented Feb 22, 2024

Describe the bug

I have the following error when I run yarn build, I ma using NextJs 14.1.0:

❯ yarn build
yarn run v1.22.19
$ node --require ./swagger-build.js ./node_modules/.bin/next build
node:internal/modules/cjs/loader:1080
  throw err;
  ^

Error: Cannot find module 'next/dist/compiled/undici'
Require stack:
- /Users/xDocuments/Projects/next-swagger-doc/examples/next14-app/swagger-build.js
- internal/preload
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/swagger-build.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at internalRequire (node:internal/modules/cjs/loader:174:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/swagger-build.js',
    'internal/preload'
  ]
}

Node.js v18.18.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Reproduction

cd examples/next14-app && yarn build

System Info

System:
    OS: macOS 14.3
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
    Memory: 16.47 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.0 - ~/.n/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.8.1 - ~/.n/bin/npm
  Browsers:
    Chrome: 121.0.6167.184
    Safari: 17.3

Used Package Manager

yarn

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@jellydn
Copy link
Owner

jellydn commented Feb 22, 2024

Thanks @geberele for the report. I will look this issue sometime this week.

@jellydn
Copy link
Owner

jellydn commented Feb 24, 2024

Hi @geberele Could you take a try with latest commit? It should work now.

@geberele
Copy link
Author

Hi @jellydn, thanks for the fix, I have just tried it and I get this error:

❯ yarn build
yarn run v1.22.19
$ next build
   ▲ Next.js 14.1.0

   Creating an optimized production build ...
 ✓ Compiled successfully

./app/layout.tsx
39:22  Warning: Invalid Tailwind CSS classnames order  tailwindcss/classnames-order

./app/page.tsx
13:12  Warning: Invalid Tailwind CSS classnames order  tailwindcss/classnames-order

./components/main-nav.tsx
17:21  Warning: Classnames 'h-6, w-6' could be replaced by the 'size-6' shorthand!  tailwindcss/enforces-shorthand
28:30  Warning: Invalid Tailwind CSS classnames order  tailwindcss/classnames-order

./components/site-header.tsx
11:13  Warning: Invalid Tailwind CSS classnames order  tailwindcss/classnames-order
27:31  Warning: Classnames 'h-5, w-5' could be replaced by the 'size-5' shorthand!  tailwindcss/enforces-shorthand
42:32  Warning: Classnames 'h-5, w-5' could be replaced by the 'size-5' shorthand!  tailwindcss/enforces-shorthand

./components/tailwind-indicator.tsx
5:10  Warning: Classnames 'h-6, w-6' could be replaced by the 'size-6' shorthand!  tailwindcss/enforces-shorthand

info  - Need to disable some ESLint rules? Learn more here: https://nextjs.org/docs/basic-features/eslint#disabling-rules
 ✓ Linting and checking validity of types    
 ✓ Collecting page data    
   Generating static pages (0/6)  [==  ] ⚠ Unsupported metadata themeColor is configured in metadata export in /. Please move it to viewport export instead.
Read more: https://nextjs.org/docs/app/api-reference/functions/generate-viewport
 ⚠ Unsupported metadata themeColor is configured in metadata export in /_not-found. Please move it to viewport export instead.
Read more: https://nextjs.org/docs/app/api-reference/functions/generate-viewport
 ⚠ Unsupported metadata themeColor is configured in metadata export in /_not-found. Please move it to viewport export instead.
Read more: https://nextjs.org/docs/app/api-reference/functions/generate-viewport
 ⚠ Unsupported metadata themeColor is configured in metadata export in /. Please move it to viewport export instead.
Read more: https://nextjs.org/docs/app/api-reference/functions/generate-viewport
   Generating static pages (1/6)  [=== ] 
 ⚠ Unsupported metadata themeColor is configured in metadata export in /api-doc. Please move it to viewport export instead.
Read more: https://nextjs.org/docs/app/api-reference/functions/generate-viewport
 ⚠ Unsupported metadata themeColor is configured in metadata export in /api-doc. Please move it to viewport export instead.
   Generating static pages (5/6)  [ ===] 
TypeError: Class extends value undefined is not a constructor or null
    at /Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/.next/server/app/api-doc/page.js:6:106416
    at /Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/.next/server/app/api-doc/page.js:12:320585
    at 8499 (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/.next/server/app/api-doc/page.js:12:320601)
    at t (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/.next/server/webpack-runtime.js:1:142)
    at 6884 (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/.next/server/app/api-doc/page.js:1:2653)
    at t (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/.next/server/webpack-runtime.js:1:142)
    at F (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:94693)
    at j (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:93244)
    at rP (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:33905)
    at nN (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:62423)
 ⚠ Unsupported metadata themeColor is configured in metadata export in /api-doc. Please move it to viewport export instead.
Read more: https://nextjs.org/docs/app/api-reference/functions/generate-viewport

Error occurred prerendering page "/api-doc". Read more: https://nextjs.org/docs/messages/prerender-error

TypeError: Class extends value undefined is not a constructor or null
    at /Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/.next/server/app/api-doc/page.js:6:106416
    at /Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/.next/server/app/api-doc/page.js:12:320585
    at 8499 (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/.next/server/app/api-doc/page.js:12:320601)
    at t (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/.next/server/webpack-runtime.js:1:142)
    at 6884 (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/.next/server/app/api-doc/page.js:1:2653)
    at t (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/.next/server/webpack-runtime.js:1:142)
    at F (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:94693)
    at j (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:93244)
    at rP (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:12:33905)
    at nN (/Users/x/Documents/Projects/next-swagger-doc/examples/next14-app/node_modules/next/dist/compiled/next-server/app-page.ru
 ✓ Generating static pages (6/6) 

> Export encountered errors on following paths:
        /api-doc/page: /api-doc
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants