TS2307: Cannot find module '_rc-trigger@5.2.0@rc-trigger' or its corresponding type declarations

Viewed 290

When I attempt to deploy the application on GitLab, not on my device, this error occurs. I've just update Antd to the last edition lately, and this has come up.

It only occurred when I tried to build it on the Gitlab

ERROR in /usr/src/app/node_modules/antd/es/tooltip/placements.d.ts
ERROR in /usr/src/app/node_modules/antd/es/tooltip/placements.d.ts(16,73):
TS2307: Cannot find module '_rc-trigger@5.2.0@rc-trigger' or its corresponding type declarations.
ERROR in /usr/src/app/node_modules/antd/lib/tooltip/placements.d.ts
ERROR in /usr/src/app/node_modules/antd/lib/tooltip/placements.d.ts(16,73):
TS2307: Cannot find module '_rc-trigger@5.2.0@rc-trigger' or its corresponding type declarations.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! optimax@1.1.6 build:dev: `webpack -p --env.stage --env.optimax --max_old_space_size=512`
npm ERR! Exit status 2

tsconfig.json

{
  "compileOnSave": true,
  "compilerOptions": {
    "outDir": "./dist/",
    "noImplicitAny": true,
    "module": "esnext",
    "target": "es6",
    "jsx": "react",
    "moduleResolution": "node",
    "skipDefaultLibCheck": true,
    "strictNullChecks": true,
    "allowJs": true,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "inlineSources": true,
    "sourceMap": true,
    "experimentalDecorators": true,
    "types": ["react", "node"],
    "typeRoots": ["node_modules/@types"],
    "baseUrl": "./",
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "**/*.spec.ts"]
}
1 Answers

Sometimes we suffer the issue of typing error in node_modules which is likely unrelated to our code. Personally I'm keen to turn it off in most use cases.

In your configuration, you also turned it off but it was the value which was deprecated skipDefaultLibCheck to be replaced by skipLibCheck.

{
  "skipLibCheck": true,
}
Related