我正在嘗試構建 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 命令進行構建
為什么我會收到此錯誤,我該如何擺脫它?
uj5u.com熱心網友回復:
該問題是由您的以下行引起的package.json:
"@types/": "ckeditor/ckeditor5-alignment",
好像yarn add走錯了 卸載它,從你的 package.json 中洗掉它,你應該很高興:)
當您的typeRoots目錄(在本例中node_modules/@types)的子目錄不包含index.d.ts.
我同意,不是一個非常明確的錯誤資訊。有關更多資訊,Microsoft/TypeScript #27956討論了同樣的問題。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/461791.html
標籤:javascript 反应 下一个.js
