简体   繁体   English

每次我尝试部署函数时,我都会收到“找不到类型定义文件...”

[英]Everytime I try to deploy functions I get "Cannot find type definition file for ..."

I am tired of seeing these errors, they are preventing me from deploying my code, what do they mean?我厌倦了看到这些错误,它们阻止我部署我的代码,它们是什么意思?

Currently I have this error:目前我有这个错误:

error TS2688: Cannot find type definition file for 'linkifyjs 2'.

error TS2688: Cannot find type definition file for 'node 2'.

I am not even using linkifyjs 2 in my code, so for what reason do I have to deal with the error that is associated with it?我什至没有在我的代码中使用linkifyjs 2 ,那么出于什么原因我必须处理与之相关的错误呢?

this is my tsconfig:这是我的 tsconfig:

{
  "compilerOptions": {
    "module": "commonjs",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "lib",
    "sourceMap": true,
    "strict": true,
    "target": "es2017"
  },
  "compileOnSave": true,
  "include": ["src"]
}

Can someone explain the origin of these errors and how can I avoid them?有人可以解释这些错误的起源以及如何避免它们吗?

I am also facing this issue.我也面临这个问题。 In this way, I resolved this issue.通过这种方式,我解决了这个问题。

The first thing you need to do is make sure you have typings for Node.js installed.您需要做的第一件事是确保您安装了 Node.js 的类型。 Open your terminal in the root directory of your project and run the following command.在项目的根目录中打开终端并运行以下命令。

npm i -D @types/node

If the error is still not resolved, try restarting your IDE.如果错误仍未解决,请尝试重新启动 IDE。

If that doesn't help, make sure the types array in your tsconfig.json file contains "node".如果这没有帮助,请确保 tsconfig.json 文件中的类型数组包含“节点”。

{
  "compilerOptions": {
    "types": [
      // ... your other types
      "node"
    ],
  },
}

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

相关问题 每次我尝试部署稳定分支时,我都会收到此错误 - Everytime I try to deploy stable branch I get this error 找不到“节点”的类型定义文件 - Cannot find type definition file for 'node' 构建:找不到“节点”的类型定义文件 - Build:Cannot find type definition file for 'node' 找不到'core-js'的类型定义文件 - Cannot find type definition file for 'core-js' “找不到‘async’的类型定义文件。TS2688” - "Cannot find type definition file for 'async'. TS2688" npm install => 找不到“节点”的类型定义文件 - npm install => Cannot find type definition file for 'node' 每当我尝试通过 Heroku 运行我的服务器时,我都会收到“错误:找不到模块 'dotenv'” - Whenever I try to run my server via Heroku I get "Error: Cannot find module 'dotenv'" 尝试要求我的javascript文件时找不到模块“ models / PermissionModel”错误 - Cannot find module 'models/PermissionModel' error when I try to require my javascript file 我在node.js源代码中找不到方法的定义 - I cannot find the definition of a method in node.js source code 当我尝试使用 Parcel 构建在开发模式下运行良好的 React 应用程序的生产版本时,我得到“找不到模块 'sass'” - When I try to use Parcel to build a production version of a React app that works fine in development mode, I get “Cannot find module 'sass'”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM