vercel / next.js

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

I am facing "HookWebpackError" at the time of optimized building. Please see the screenshot. #49064

Open hozaifa4you opened 1 year ago

hozaifa4you commented 1 year ago

Verify canary release

Provide environment information

I am facing a problem, when I try to build. 
Please take a look at the screenshot carefully and tell me how to fix the problem.

@yousu ➜ realtime-chat-application git(master) yarn build
yarn run v1.22.19
$ next build
info  - Loaded env from C:\Users\yousu\Desktop\realtime-chat-application\.env
warn  - You have enabled experimental feature (appDir) in next.config.js.
warn  - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
info  - Thank you for testing `appDir` please leave your feedback at https://nextjs.link/app-feedback

info  - Creating an optimized production build .<w> [webpack.cache.PackFileCacheStrategy] Serializing big strings (659kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)
Failed to compile.

HookWebpackError: File C:\Users\yousu\Desktop\realtime-chat-application\.next\server\app\favicon.ico\route.js does not exist.
    at makeWebpackError (C:\Users\yousu\Desktop\realtime-chat-application\node_modules\next\dist\compiled\webpack\bundle5.js:28:308185)
    at C:\Users\yousu\Desktop\realtime-chat-application\node_modules\next\dist\compiled\webpack\bundle5.js:28:105236
    at eval (eval at create (C:\Users\yousu\Desktop\realtime-chat-application\node_modules\next\dist\compiled\webpack\bundle5.js:13:28771), <anonymous>:57:1)
    at C:\Users\yousu\Desktop\realtime-chat-application\node_modules\next\dist\compiled\webpack\bundle5.js:28:68649
    at C:\Users\yousu\Desktop\realtime-chat-application\node_modules\next\dist\build\webpack\plugins\next-trace-entrypoints-plugin.js:420:143
-- inner error --
Error: File C:\Users\yousu\Desktop\realtime-chat-application\.next\server\app\favicon.ico\route.js does not exist.
    at Job.emitDependency (C:\Users\yousu\Desktop\realtime-chat-application\node_modules\next\dist\compiled\@vercel\nft\index.js:1:39473)
    at async Promise.all (index 24)
    at async nodeFileTrace (C:\Users\yousu\Desktop\realtime-chat-application\node_modules\next\dist\compiled\@vercel\nft\index.js:1:35430)
    at async C:\Users\yousu\Desktop\realtime-chat-application\node_modules\next\dist\build\webpack\plugins\next-trace-entrypoints-plugin.js:141:28
    at async Span.traceAsyncFn (C:\Users\yousu\Desktop\realtime-chat-application\node_modules\next\dist\trace\trace.js:97:20)
    at async TraceEntryPointsPlugin.createTraceAssets (C:\Users\yousu\Desktop\realtime-chat-application\node_modules\next\dist\build\webpack\plugins\next-trace-entrypoints-plugin.js:95:9)
caused by plugins in Compilation.hooks.processAssets
Error: File C:\Users\yousu\Desktop\realtime-chat-application\.next\server\app\favicon.ico\route.js does not exist.
    at Job.emitDependency (C:\Users\yousu\Desktop\realtime-chat-application\node_modules\next\dist\compiled\@vercel\nft\index.js:1:39473)
    at async Promise.all (index 24)
    at async nodeFileTrace (C:\Users\yousu\Desktop\realtime-chat-application\node_modules\next\dist\compiled\@vercel\nft\index.js:1:35430)
    at async C:\Users\yousu\Desktop\realtime-chat-application\node_modules\next\dist\build\webpack\plugins\next-trace-entrypoints-plugin.js:141:28
    at async Span.traceAsyncFn (C:\Users\yousu\Desktop\realtime-chat-application\node_modules\next\dist\trace\trace.js:97:20)
    at async TraceEntryPointsPlugin.createTraceAssets (C:\Users\yousu\Desktop\realtime-chat-application\node_modules\next\dist\build\webpack\plugins\next-trace-entrypoints-plugin.js:95:9)

> Build failed because of webpack errors
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true), CLI (create-next-app), ESLint (eslint-config-next), Image optimization (next/image, next/legacy/image), Metadata (metadata, generateMetadata, next/head, head.js), Middleware / Edge (API routes, runtime), Operating System (Windows, MacOS, Linux), Package manager (npm, pnpm, Yarn)

Link to the code that reproduces this issue

https://github.com/yousuf4you/reattime-chat-application

To Reproduce

Building time bug

Describe the Bug

building time error

Expected Behavior

can't build

Which browser are you using? (if relevant)

Chrome

How are you deploying your application? (if relevant)

Vercel

Rishab49 commented 1 year ago

Maybe this issue is fixed here https://github.com/vercel/next.js/pull/48779/commits/05d486f68898881ed1a1defed21cf7c708d2d1e8 your issue is similar to https://github.com/vercel/next.js/issues/48603 and upgrading your version may fix this issue

hozaifa4you commented 1 year ago

Not working with this method.

hozaifa4you commented 1 year ago

I am facing this issue with Windows 11 but on Linux, I am not facing any problem like that.