部署到 vercel 时找不到 CSS 模块的问题

时间:2021-02-24 23:17:21

标签: next.js vercel

这是错误日志。我一辈子都无法解决这个问题。在开发中一切正常,但在部署时失败。 :(

23:12:53.687    Failed to compile.
23:12:53.687    ModuleNotFoundError: Module not found: Error: Can't resolve '../../styles/Homebody.module.css' in '/vercel/workpath0/components/Home'
23:12:53.687    > Build error occurred
23:12:53.688    Error: > Build failed because of webpack errors
23:12:53.688        at /vercel/workpath0/node_modules/next/dist/build/index.js:15:918
23:12:53.689        at runMicrotasks (<anonymous>)
23:12:53.689        at processTicksAndRejections (internal/process/task_queues.js:93:5)
23:12:53.689        at async /vercel/workpath0/node_modules/next/dist/build/tracer.js:3:470
23:12:53.704    npm ERR! code ELIFECYCLE
23:12:53.704    npm ERR! errno 1
23:12:53.707    npm ERR! next_front@0.1.0 build: `next build && next export`
23:12:53.707    npm ERR! Exit status 1
23:12:53.707    npm ERR! 
23:12:53.707    npm ERR! Failed at the next_front@0.1.0 build script.
23:12:53.707    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
23:12:53.714    npm ERR! A complete log of this run can be found in:
23:12:53.714    npm ERR!     /vercel/.npm/_logs/2021-02-24T23_12_53_708Z-debug.log
23:12:53.719    Error: Command "npm run build" exited with 1

0 个答案:

没有答案