vercel / next.js

The React Framework
https://nextjs.org
MIT License
126.85k stars 26.96k forks source link

Can't Build Site #32807

Closed quick007 closed 2 years ago

quick007 commented 2 years ago

What version of Next.js are you using?

12.0.7

What version of Node.js are you using?

17.0.1

What browser are you using?

Chrome

What operating system are you using?

Windows 11

How are you deploying your application?

Not needed, it doesn't work locally

Describe the Bug

The error link that's provided in the error message is https://nextjs.org/docs/messages/invalid-resolve-alias

We don't have a webpack config.

Heres our nextjs config: https://github.com/wave-studio/JSBoard/blob/master/next.config.js

Heres the full error:

PS C:\Users\<user>\OneDrive\Documents\GitHub\JSBoard> yarn build
yarn run v1.22.5
$ next build
info  - Loaded env from C:\Users\<user>\OneDrive\Documents\GitHub\JSBoard\.env.local
warn  - The `target` config is deprecated and will be removed in a future version.
See more info here https://nextjs.org/docs/messages/deprecated-target-config
info  - Checking validity of types  
warn  - No ESLint configuration detected. Run next lint to begin setup
warn  - using beta Middleware (not covered by semver) - https://nextjs.org/docs/messages/beta-middleware
> [PWA] Compile client (static)
> [PWA] Auto register service worker with: C:\Users\<user>\OneDrive\Documents\GitHub\JSBoard\node_modules\next-pwa\register.js
> [PWA] Service worker: C:\Users\<user>\OneDrive\Documents\GitHub\JSBoard\public\sw.js
> [PWA]   url: /sw.js
> [PWA]   scope: /
> [PWA] Compile server
info  - Creating an optimized production build  
Failed to compile.

./node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <!doctype html>
| <html>
| <head>

Import trace for requested module:
./node_modules/@mapbox/node-pre-gyp/lib/ sync ^\.\/.*$
./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js
./node_modules/bcrypt/bcrypt.js
./lib/auth.tsx
./pages/api/socketModules/user.tsx
./node_modules/next/dist/build/webpack/loaders/next-serverless-loader/index.js?page=%2Fapi%2FsocketModules%2Fuser&absolutePagePath=private-next-pages%2Fapi%2FsocketModules%2Fuser.tsx&absoluteAppPath=private-next-pages%2F_app.tsx&absoluteDocumentPath=next%2Fdist%2Fpages%2F_document&absoluteErrorPath=next%2Fdist%2Fpages%2F_error&absolute404Path=private-next-pages%2F404.tsx&distDir=private-dot-next&buildId=build&assetPrefix=&generateEtags=true&poweredByHeader=true&canonicalBase=&basePath=&runtimeConfig=&previewProps=%7B%22previewModeId%22%3A%221006800563581b26875722b8128e86d4%22%2C%22previewModeSigningKey%22%3A%22c0895f22f9a76a4f0020df1089842221cbbe77a506b80ff06c73ee3baf916ac6%22%2C%22previewModeEncryptionKey%22%3A%22ae6aa601e92d26dc7041e28ba4ffbb32dc7c5440e71d5fe8e4484c3cfa96f4d2%22%7D&loadedEnvFiles=W3sicGF0aCI6Ii5lbnYubG9jYWwiLCJjb250ZW50cyI6IkRCX0xJTks9XCJtb25nb2RiK3NydjovL2RibWFuYWdlcjp4M0dNcjlicFFnNVRmdWIzQGNsdXN0ZXIwLmFsZHJ2Lm1vbmdvZGIubmV0L215Rmlyc3REYXRhYmFzZT9yZXRyeVdyaXRlcz10cnVlJnc9bWFqb3JpdHlcIiJ9XQ%3D%3D&i18n=!

./node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js
Module not found: Can't resolve 'mock-aws-s3' in 'C:\Users\<user>\OneDrive\Documents\GitHub\JSBoard\node_modules\@mapbox\node-pre-gyp\lib\util'

Import trace for requested module:
./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js
./node_modules/bcrypt/bcrypt.js
./lib/auth.tsx
./pages/api/socketModules/user.tsx
./pages/api/socketModules/ lazy ^\.\/.*$ namespace object
./pages/api/socket.tsx
./node_modules/next/dist/build/webpack/loaders/next-serverless-loader/index.js?page=%2Fapi%2Fsocket&absolutePagePath=private-next-pages%2Fapi%2Fsocket.tsx&absoluteAppPath=private-next-pages%2F_app.tsx&absoluteDocumentPath=next%2Fdist%2Fpages%2F_document&absoluteErrorPath=next%2Fdist%2Fpages%2F_error&absolute404Path=private-next-pages%2F404.tsx&distDir=private-dot-next&buildId=build&assetPrefix=&generateEtags=true&poweredByHeader=true&canonicalBase=&basePath=&runtimeConfig=&previewProps=%7B%22previewModeId%22%3A%221006800563581b26875722b8128e86d4%22%2C%22previewModeSigningKey%22%3A%22c0895f22f9a76a4f0020df1089842221cbbe77a506b80ff06c73ee3baf916ac6%22%2C%22previewModeEncryptionKey%22%3A%22ae6aa601e92d26dc7041e28ba4ffbb32dc7c5440e71d5fe8e4484c3cfa96f4d2%22%7D&loadedEnvFiles=W3sicGF0aCI6Ii5lbnYubG9jYWwiLCJjb250ZW50cyI6IkRCX0xJTks9XCJtb25nb2RiK3NydjovL2RibWFuYWdlcjp4M0dNcjlicFFnNVRmdWIzQGNsdXN0ZXIwLmFsZHJ2Lm1vbmdvZGIubmV0L215Rmlyc3REYXRhYmFzZT9yZXRyeVdyaXRlcz10cnVlJnc9bWFqb3JpdHlcIiJ9XQ%3D%3D&i18n=!

./node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js
Module not found: Can't resolve 'aws-sdk' in 'C:\Users\<user>\OneDrive\Documents\GitHub\JSBoard\node_modules\@mapbox\node-pre-gyp\lib\util'

Import trace for requested module:
./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js
./node_modules/bcrypt/bcrypt.js
./lib/auth.tsx
./pages/api/socketModules/user.tsx
./pages/api/socketModules/ lazy ^\.\/.*$ namespace object
./pages/api/socket.tsx
./node_modules/next/dist/build/webpack/loaders/next-serverless-loader/index.js?page=%2Fapi%2Fsocket&absolutePagePath=private-next-pages%2Fapi%2Fsocket.tsx&absoluteAppPath=private-next-pages%2F_app.tsx&absoluteDocumentPath=next%2Fdist%2Fpages%2F_document&absoluteErrorPath=next%2Fdist%2Fpages%2F_error&absolute404Path=private-next-pages%2F404.tsx&distDir=private-dot-next&buildId=build&assetPrefix=&generateEtags=true&poweredByHeader=true&canonicalBase=&basePath=&runtimeConfig=&previewProps=%7B%22previewModeId%22%3A%221006800563581b26875722b8128e86d4%22%2C%22previewModeSigningKey%22%3A%22c0895f22f9a76a4f0020df1089842221cbbe77a506b80ff06c73ee3baf916ac6%22%2C%22previewModeEncryptionKey%22%3A%22ae6aa601e92d26dc7041e28ba4ffbb32dc7c5440e71d5fe8e4484c3cfa96f4d2%22%7D&loadedEnvFiles=W3sicGF0aCI6Ii5lbnYubG9jYWwiLCJjb250ZW50cyI6IkRCX0xJTks9XCJtb25nb2RiK3NydjovL2RibWFuYWdlcjp4M0dNcjlicFFnNVRmdWIzQGNsdXN0ZXIwLmFsZHJ2Lm1vbmdvZGIubmV0L215Rmlyc3REYXRhYmFzZT9yZXRyeVdyaXRlcz10cnVlJnc9bWFqb3JpdHlcIiJ9XQ%3D%3D&i18n=!

./node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js
Module not found: Can't resolve 'nock' in 'C:\Users\<user>\OneDrive\Documents\GitHub\JSBoard\node_modules\@mapbox\node-pre-gyp\lib\util'

Import trace for requested module:
./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js
./node_modules/bcrypt/bcrypt.js
./lib/auth.tsx
./pages/api/socketModules/user.tsx
./pages/api/socketModules/ lazy ^\.\/.*$ namespace object
./pages/api/socket.tsx
./node_modules/next/dist/build/webpack/loaders/next-serverless-loader/index.js?page=%2Fapi%2Fsocket&absolutePagePath=private-next-pages%2Fapi%2Fsocket.tsx&absoluteAppPath=private-next-pages%2F_app.tsx&absoluteDocumentPath=next%2Fdist%2Fpages%2F_document&absoluteErrorPath=next%2Fdist%2Fpages%2F_error&absolute404Path=private-next-pages%2F404.tsx&distDir=private-dot-next&buildId=build&assetPrefix=&generateEtags=true&poweredByHeader=true&canonicalBase=&basePath=&runtimeConfig=&previewProps=%7B%22previewModeId%22%3A%221006800563581b26875722b8128e86d4%22%2C%22previewModeSigningKey%22%3A%22c0895f22f9a76a4f0020df1089842221cbbe77a506b80ff06c73ee3baf916ac6%22%2C%22previewModeEncryptionKey%22%3A%22ae6aa601e92d26dc7041e28ba4ffbb32dc7c5440e71d5fe8e4484c3cfa96f4d2%22%7D&loadedEnvFiles=W3sicGF0aCI6Ii5lbnYubG9jYWwiLCJjb250ZW50cyI6IkRCX0xJTks9XCJtb25nb2RiK3NydjovL2RibWFuYWdlcjp4M0dNcjlicFFnNVRmdWIzQGNsdXN0ZXIwLmFsZHJ2Lm1vbmdvZGIubmV0L215Rmlyc3REYXRhYmFzZT9yZXRyeVdyaXRlcz10cnVlJnc9bWFqb3JpdHlcIiJ9XQ%3D%3D&i18n=!

./node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js
Module not found: Can't resolve 'mock-aws-s3' in 'C:\Users\<user>\OneDrive\Documents\GitHub\JSBoard\node_modules\@mapbox\node-pre-gyp\lib\util'

Import trace for requested module:
./node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js
./node_modules/bcrypt/bcrypt.js
./lib/auth.tsx
./pages/api/socketModules/user.tsx
./node_modules/next/dist/build/webpack/loaders/next-serverless-loader/index.js?page=%2Fapi%2FsocketModules%2Fuser&absolutePagePath=private-next-pages%2Fapi%2FsocketModules%2Fuser.tsx&absoluteAppPath=private-next-pages%2F_app.tsx&absoluteDocumentPath=next%2Fdist%2Fpages%2F_document&absoluteErrorPath=next%2Fdist%2Fpages%2F_error&absolute404Path=private-next-pages%2F404.tsx&distDir=private-dot-next&buildId=build&assetPrefix=&generateEtags=true&poweredByHeader=true&canonicalBase=&basePath=&runtimeConfig=&previewProps=%7B%22previewModeId%22%3A%221006800563581b26875722b8128e86d4%22%2C%22previewModeSigningKey%22%3A%22c0895f22f9a76a4f0020df1089842221cbbe77a506b80ff06c73ee3baf916ac6%22%2C%22previewModeEncryptionKey%22%3A%22ae6aa601e92d26dc7041e28ba4ffbb32dc7c5440e71d5fe8e4484c3cfa96f4d2%22%7D&loadedEnvFiles=W3sicGF0aCI6Ii5lbnYubG9jYWwiLCJjb250ZW50cyI6IkRCX0xJTks9XCJtb25nb2RiK3NydjovL2RibWFuYWdlcjp4M0dNcjlicFFnNVRmdWIzQGNsdXN0ZXIwLmFsZHJ2Lm1vbmdvZGIubmV0L215Rmlyc3REYXRhYmFzZT9yZXRyeVdyaXRlcz10cnVlJnc9bWFqb3JpdHlcIiJ9XQ%3D%3D&i18n=!

Expected Behavior

It building correctly

To Reproduce

I'm honestly not sure how to reproduce it, I have been ignoring build issues for a while (because netlify was broken and I never attempted it locally) so I can't pinpoint what it may be.

balazsorban44 commented 2 years ago

Could you please try isolating the issue. Try removing dependencies/pages code until you have a minimal reproduction that still have the issue you are experiencing. This way we can confirm if this is an actual issue with Next.ja or not.

Please address the warnings/errors first.

Eg target has been deprecated https://nextjs.org/blog/next-12#output-file-tracing

github-actions[bot] commented 2 years ago

This issue has been automatically closed after 30 days of inactivity with no reproduction. If you are running into a similar issue, please open a new issue with a reproduction. Thank you.

github-actions[bot] commented 2 years ago

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.