【发布时间】:2021-08-19 10:28:48
【问题描述】:
我有一个项目已经部署在 Vercel 上。自上周以来,我一直致力于改进布局,目标是完成该项目的 MVP。所以,我改变了我对 auth0 的使用,使用包为 nextjs @auth0/nextjs-auth0。我跑了
npm install @auth0/nextjs-auth0
我的 package.json 上有
{
"name": "MAmanager",
"version": "1.0.0",
"engines": {
"node": "14.x",
"npm": "6.x"
},
"description": "",
"main": "index.js",
"scripts": {
"dev": "next",
"start": "next start",
"build": "next build"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@auth0/nextjs-auth0": "github:auth0/nextjs-auth0",
"dayjs": "^1.9.5",
"formik": "^2.1.5",
"next": "^10.2.3",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-icons": "^4.2.0",
"swr": "^0.5.6",
"yup": "^0.29.3"
},
"devDependencies": {
"autoprefixer": "^10.2.5",
"postcss": "^8.3.0",
"tailwindcss": "^2.1.2"
}
}
我的页面上的用法是
import { UserProvider } from '@auth0/nextjs-auth0'
import { useUser } from '@auth0/nextjs-auth0'
import { withPageAuthRequired } from '@auth0/nextjs-auth0'
当我在 Vercel 上部署我的分支时出现此错误
08:57:49.989 Failed to compile.
08:57:49.990 ModuleNotFoundError: Module not found: Error: Can't resolve '@auth0/nextjs-auth0' in '/vercel/path0/pages'
08:57:49.990 > Build error occurred
08:57:49.991 Error: > Build failed because of webpack errors
08:57:49.991 at /vercel/path0/node_modules/next/dist/build/index.js:17:924
08:57:49.991 at async Span.traceAsyncFn (/vercel/path0/node_modules/next/dist/telemetry/trace/trace.js:6:584)
08:57:50.020 error Command failed with exit code 1.
我看到过由大小写差异引起的错误,但我不明白这里发生了什么。感谢您的帮助。
【问题讨论】:
标签: javascript node.js next.js node-modules auth0