【发布时间】:2022-01-11 13:02:15
【问题描述】:
我在 nginx 上使用 nextjs 和 nextauth。我遇到了构建失败,但我不确定如何修复此错误。
2021-12-06T09:35:02.4779281Z https://nextjs.org/telemetry
2021-12-06T09:35:02.4779648Z
2021-12-06T09:35:02.7626345Z info - Checking validity of types...
2021-12-06T09:35:03.6479273Z warn - No ESLint configuration detected. Run next lint to begin setup
2021-12-06T09:35:03.6504824Z info - Creating an optimized production build...
2021-12-06T09:35:11.0167427Z Failed to compile.
2021-12-06T09:35:11.0168180Z
2021-12-06T09:35:11.0173424Z ModuleNotFoundError: Module not found: Error: Package path ./client is not exported from package /var/www/html/node_modules/next-auth (see exports field in /var/www/html/node_modules/next-auth/package.json)
2021-12-06T09:35:11.0177457Z
2021-12-06T09:35:11.0181521Z
2021-12-06T09:35:11.0184681Z > Build error occurred
2021-12-06T09:35:11.0202372Z Error: > Build failed because of webpack errors
2021-12-06T09:35:11.0203202Z at nextBuildSpan.traceAsyncFn (/var/www/html/node_modules/next/dist/build/index.js:397:19)
2021-12-06T09:35:11.0490267Z npm ERR! code ELIFECYCLE
2021-12-06T09:35:11.0502899Z npm ERR! errno 1
2021-12-06T09:35:11.0522169Z npm ERR! my-app@1.0.1 build: `next build`
2021-12-06T09:35:11.0529617Z npm ERR! Exit status 1
2021-12-06T09:35:11.0538648Z npm ERR!
2021-12-06T09:35:11.0546568Z npm ERR! Failed at the my-app@1.0.1 build script.
2021-12-06T09:35:11.0554061Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2021-12-06T09:35:11.0650303Z
2021-12-06T09:35:11.0658427Z npm ERR! A complete log of this run can be found in:
2021-12-06T09:35:11.0665933Z npm ERR! /home/ubuntu/.npm/_logs/2021-12-06T09_35_11_056Z-debug.log
2021-12-06T09:35:11.0875406Z ##[error]Bash exited with code '1'.
2021-12-06T09:35:11.0952428Z ##[section]Finishing: npm run build
对下一步做什么有帮助吗?我该如何解决这个问题?今天早上我一直在为这个错误而苦苦挣扎。
【问题讨论】:
-
您使用的 next-auth 版本是什么?
-
最新的。我现在已经修好了。我必须降级到 Nextjs v11.1.2 才能正常工作
标签: reactjs next.js azure-pipelines next-auth