简体   繁体   中英

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?

this is my 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. 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.

If that doesn't help, make sure the types array in your tsconfig.json file contains "node".

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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