简体   繁体   English

在tsconfig.json中找不到'redux-logger'错误的类型定义文件

[英]Cannot find type definition file for 'redux-logger' error in tsconfig.json

I'm working in a react application using typescript and redux. 我正在使用Typescript和Redux的React应用程序中工作。 I updated several npm packages, between them the typescript package and now the tsconfig.json (typescrip compiler configuration file) is showing me the following error: 我更新了几个包故宫,它们之间的typescript包现在tsconfig.json (typescrip编译器配置文件)向我展示了以下错误:

Cannot find type definition file for 'redux-logger' 找不到“ redux-logger”的类型定义文件

I tried to search that issue here and google, but I could not find what I need to include in the tsconfig.json. 我试图在此处和Google上搜索该问题,但找不到tsconfig.json中需要包含的内容。 This is the content of the file: 这是文件的内容:

{
  "compilerOptions": {
    "outDir": "build/dist",
    "module": "esnext",
    "target": "es5",
    "lib": ["es6", "dom"],
    "sourceMap": true,
    "allowJs": true,
    "jsx": "react",
    "moduleResolution": "node",
    "rootDir": ".",
    "forceConsistentCasingInFileNames": true,
    "noImplicitReturns": true,
    "noImplicitThis": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "suppressImplicitAnyIndexErrors": true,
    "noUnusedLocals": true,
    "allowSyntheticDefaultImports": true,
  },
  "exclude": [
    "node_modules",
    "build",
    "scripts",
    "acceptance-tests",
    "webpack",
    "jest",
    "src/setupTests.ts"
  ],
  "include": [
      "./src/**/*"
  ]
}

Am I need to include something new now in the tsconfig.json? 我是否需要在tsconfig.json中添加新内容? The project compiles and runs well, but this error bothers me 该项目编译并运行良好,但是此错误困扰我

错误

And these are the version of npm packages: 这些是npm软件包的版本:

{
  "name": "documentloader",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^3.0.3",
    "@material-ui/icons": "^3.0.1",
    "react": "16.5.2",
    "react-dom": "16.5.2",
    "react-redux": "^5.0.7",
    "react-redux-loading-bar": "^4.0.8",
    "react-router-dom": "^4.3.1",
    "react-scripts-ts": "latest",
    "react-toastify": "^4.4.0",
    "react-transition-group": "^2.5.0",
    "redux": "^4.0.1",
    "redux-logger": "^3.0.6",
    "redux-persist": "^5.10.0",
    "redux-saga": "^0.16.2",
    "redux-thunk": "^2.3.0",
    "ts-loader": "^5.2.2"
  },
  "devDependencies": {
    "@types/classnames": "^2.2.6",
    "@types/history": "^4.7.1",
    "@types/jest": "^23.3.5",
    "@types/node": "10.12.0",
    "@types/ramda": "^0.25.39",
    "@types/react": "16.4.18",
    "@types/react-dom": "^16.0.9",
    "@types/react-redux": "^6.0.9",
    "@types/react-router-dom": "^4.3.1",
    "@types/redux-logger": "^3.0.6",
    "@types/webpack-env": "^1.13.6",
    "awesome-typescript-loader": "^5.2.1",
    "css-loader": "^1.0.0",
    "csstype": "^2.5.7",
    "file-loader": "^2.0.0",
    "html-webpack-plugin": "^3.2.0",
    "redux-devtools-extension": "^2.13.5",
    "source-map-loader": "^0.2.4",
    "style-loader": "^0.23.1",
    "typescript": "^3.1.3",
    "webpack": "^4.20.2",
    "webpack-cli": "^3.1.2",
    "webpack-dev-middleware": "^3.4.0",
    "webpack-dev-server": "^3.1.9",
    "webpack-hot-middleware": "^2.24.3"
  }
 }

Update 更新资料

Content of @types/redux-logger folder: @ types / redux-logger文件夹的内容: 夹

This error most likely means that the typeRoots mechanism found a directory that appeared to represent a package named @types/redux-logger , but the directory did not contain a declaration file. 该错误很可能意味着typeRoots机制找到了一个目录,该目录似乎表示名为@types/redux-logger的软件包,但该目录不包含声明文件。 If you have an empty directory at node_modules/@types/redux-logger , try deleting it. 如果node_modules/@types/redux-logger目录为空,请尝试将其删除。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM