#reactjs #next.js #vercel
Вопрос:
Я пытаюсь развернуть свой next.js приложение через vercel. Он полностью хорошо работает в локальной среде с помощью команды «npm run dev». Но когда я попытался развернуть его через vercel с удаленным репозиторием Github, он выдает ошибку, как показано ниже:
warn - No ESLint configuration detected. Run next lint to begin setup info - Creating an optimized production build... warn - You have enabled the JIT engine which is currently in preview. warn - Preview features are not covered by semver, may introduce breaking changes, and can change at any time. Failed to compile. ./components/Feed.js Module not found: Can't resolve 'next-auth/react' in '/vercel/path0/components' Import trace for requested module: ./pages/index.js ./components/Header.js Module not found: Can't resolve 'next-auth/react' in '/vercel/path0/components' Import trace for requested module: ./pages/index.js ./components/MiniProfile.js Module not found: Can't resolve 'next-auth/react' in '/vercel/path0/components' Import trace for requested module: ./components/Feed.js ./pages/index.js ./components/Modal.js Module not found: Can't resolve 'next-auth/react' in '/vercel/path0/components' Import trace for requested module: ./pages/index.js ./components/Post.js Module not found: Can't resolve 'next-auth/react' in '/vercel/path0/components' Import trace for requested module: ./components/Posts.js ./components/Feed.js ./pages/index.js gt; 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. Error: Command "yarn run build" exited with 1
Вот мой пакет.json
{ "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start" }, "dependencies": { "@headlessui/react": "^1.4.2", "@heroicons/react": "^1.0.5", "@tailwindcss/forms": "^0.3.4", "axios": "^0.24.0", "faker": "^5.5.3", "firebase": "^9.3.0", "moment": "^2.29.1", "next": "latest", "next-auth": "^4.0.0-beta.4", "react": "^17.0.2", "react-dom": "^17.0.2", "react-moment": "^1.1.1", "recoil": "^0.5.2", "tailwind-scrollbar-hide": "^1.1.5" }, "devDependencies": { "autoprefixer": "^10.2.6", "postcss": "^8.3.5", "tailwind-scrollbar": "^1.3.1", "tailwindcss": "^2.2.4" } }
Есть идеи, почему при развертывании на Vercel возникает ошибка компиляции?
Комментарии:
1. Можете ли вы воспроизвести проблему локально, запустив производственную сборку (
next build amp;amp; next start
)?