我正在尝试在 Vercel 上部署我的 NextJS 和 Sanity 项目,但我收到此构建错误:
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry
info - Linting and checking validity of types...
Failed to compile.
./sanity-studio/sanity.config.ts:3:26
Type error: Cannot find module '@sanity/vision' or its corresponding type declarations.
1 | import {defineConfig} from 'sanity'
2 | import {deskTool} from 'sanity/desk'
> 3 | import {visionTool} from '@sanity/vision'
| ^
4 | import {schemaTypes} from './schemas'
5 |
6 | export default defineConfig({
Error: Command "npm run build" exited with 1
这是我在根目录下的 package.json 文件:
{
"name": "jeannes-desserts",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"test": "jest --watchAll --verbose",
"test-ci": "jest --verbose"
},
"jest": {
"testEnvironment": "jsdom",
"moduleNameMapper": {
"\\.(css|less|scss|sass)$": "identity-obj-proxy"
}
},
"dependencies": {
"@next/font": "13.1.6",
"@portabletext/react": "^2.0.1",
"@sanity/client": "^4.0.1",
"@sanity/image-url": "^1.0.2",
"@sendgrid/mail": "^7.7.0",
"@types/node": "18.11.18",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"eslint": "8.32.0",
"eslint-config-next": "13.1.6",
"next": "13.1.6",
"next-sanity": "^4.1.2",
"react": "18.2.0",
"react-calendly": "^4.1.1",
"react-dom": "18.2.0",
"react-icons": "^4.7.1",
"react-multi-carousel": "^2.8.2",
"sharp": "^0.31.3",
"typescript": "4.9.4"
},
"devDependencies": {
"@next/bundle-analyzer": "^13.2.1",
"@tailwindcss/forms": "^0.5.3",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^29.4.0",
"autoprefixer": "^10.4.13",
"identity-obj-proxy": "^3.0.0",
"jest": "^29.4.2",
"jest-environment-jsdom": "^29.4.2",
"postcss": "^8.4.21",
"tailwindcss": "^3.2.4"
}
}
这是 sanity-studio 目录(根目录中的 sanity-studio 目录)中的 package.json:
{
"name": "jeannes-desserts",
"private": true,
"version": "1.0.0",
"main": "package.json",
"license": "UNLICENSED",
"scripts": {
"dev": "sanity dev",
"start": "sanity start",
"build": "sanity build",
"deploy": "sanity deploy",
"deploy-graphql": "sanity graphql deploy"
},
"keywords": [
"sanity"
],
"dependencies": {
"@sanity/vision": "^3.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-is": "^18.2.0",
"sanity": "^3.0.0",
"styled-components": "^5.2.0"
},
"devDependencies": {
"@sanity/eslint-config-studio": "^2.0.1",
"eslint": "^8.6.0",
"prettier": "^2.8.3",
"typescript": "^4.0.0"
},
"prettier": {
"semi": false,
"printWidth": 100,
"bracketSpacing": false,
"singleQuote": true
}
}
我在这里遗漏了什么吗?任何帮助或建议都会有所帮助。