【发布时间】:2022-01-05 10:38:57
【问题描述】:
操作系统:Windows 10 节点:16.13.0 NextJS:12
我刚刚升级到 nextjs 12,现在在 next build 上获得 Module not found
这工作正常
next -p 3000
但是当我运行next build 时,事情似乎正在编译,但最后它失败并出现以下错误。
> next build
...
info - Creating an optimized production build .Warning: 4 repetitive deprecation warnings omitted.
info - Creating an optimized production build
Failed to compile.
Module not found: Error: Can't resolve './C:/Users/X/AppData/Roaming/npm/node_modules/next/dist/client/next.js' in 'F:\myproject\x\client'
> Build failed because of webpack errors
既然它在抱怨 next.js,我认为它与我的其他库没有任何关系吗?我的应用程序在 nextjs 开发模式下运行良好。
【问题讨论】:
-
再次尝试
npm i重新安装所有依赖项,然后重新构建。 -
删除
.next和node_modules目录并锁定文件。然后运行yarn或npm i。如果它仍然不起作用,请为我们提供一个最小的、可重现的示例,并且可以选择在 github.com/vercel/next.js/issues 创建一个问题。