Next.js project build error: Entry point for implicit type library 'build'
Next.js project build error: Entry point for implicit type library 'build'
我正在尝试构建 nextjs 项目并收到此错误:
Type error: Cannot find type definition file for 'build'.
The file is in the program because:
Entry point for implicit type library 'build'
如何构建而不出现此错误?
这是 package.json 的样子:
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"license": "fa",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@ckeditor/ckeditor5-alignment": "^33.0.0",
"@ckeditor/ckeditor5-build-classic": "^33.0.0",
"@ckeditor/ckeditor5-code-block": "^33.0.0",
"@ckeditor/ckeditor5-react": "^4.0.0",
"@hookform/resolvers": "^2.8.8",
"@types/": "ckeditor/ckeditor5-alignment",
"axios": "^0.26.0",
"dompurify": "^2.3.6",
"highlight.js": "^11.5.0",
"isomorphic-dompurify": "^0.18.0",
"mobx": "^6.4.2",
"mobx-react-lite": "^3.3.0",
"next": "^12.1.5",
"nextjs-progressbar": "^0.0.14",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-hook-form": "^7.27.1",
"sass": "^1.49.9",
"yup": "^0.32.11"
},
"devDependencies": {
"@types/node": "^17.0.25",
"@types/react": "^18.0.6",
"eslint": "8.10.0",
"eslint-config-next": "12.1.0",
"typescript": "^4.6.3"
}
}
我正在尝试使用 yarn build 命令进行构建
为什么会出现此错误,我该如何摆脱它?
问题是由您 package.json
:
中的这一行引起的
"@types/": "ckeditor/ckeditor5-alignment",
看起来 yarn add
出错了。卸载它,将其从您的 package.json 中删除,然后您就可以开始了:)
当 typeRoots
目录(在本例中为 node_modules/@types
)的子目录不包含 index.d.ts
.
时,会出现此问题
同意,错误信息不是很清楚。有关更多信息,Microsoft/TypeScript #27956 讨论了同样的问题。
我正在尝试构建 nextjs 项目并收到此错误:
Type error: Cannot find type definition file for 'build'.
The file is in the program because:
Entry point for implicit type library 'build'
如何构建而不出现此错误?
这是 package.json 的样子:
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"license": "fa",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@ckeditor/ckeditor5-alignment": "^33.0.0",
"@ckeditor/ckeditor5-build-classic": "^33.0.0",
"@ckeditor/ckeditor5-code-block": "^33.0.0",
"@ckeditor/ckeditor5-react": "^4.0.0",
"@hookform/resolvers": "^2.8.8",
"@types/": "ckeditor/ckeditor5-alignment",
"axios": "^0.26.0",
"dompurify": "^2.3.6",
"highlight.js": "^11.5.0",
"isomorphic-dompurify": "^0.18.0",
"mobx": "^6.4.2",
"mobx-react-lite": "^3.3.0",
"next": "^12.1.5",
"nextjs-progressbar": "^0.0.14",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-hook-form": "^7.27.1",
"sass": "^1.49.9",
"yup": "^0.32.11"
},
"devDependencies": {
"@types/node": "^17.0.25",
"@types/react": "^18.0.6",
"eslint": "8.10.0",
"eslint-config-next": "12.1.0",
"typescript": "^4.6.3"
}
}
我正在尝试使用 yarn build 命令进行构建
为什么会出现此错误,我该如何摆脱它?
问题是由您 package.json
:
"@types/": "ckeditor/ckeditor5-alignment",
看起来 yarn add
出错了。卸载它,将其从您的 package.json 中删除,然后您就可以开始了:)
当 typeRoots
目录(在本例中为 node_modules/@types
)的子目录不包含 index.d.ts
.
同意,错误信息不是很清楚。有关更多信息,Microsoft/TypeScript #27956 讨论了同样的问题。