Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
681 views
in Technique[技术] by (71.8m points)

reactjs - TS2307: Cannot find module '[email protected]@rc-trigger' or its corresponding type declarations

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 '[email protected]@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 '[email protected]@rc-trigger' or its corresponding type declarations.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] 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"]
}
question from:https://stackoverflow.com/questions/65651300/ts2307-cannot-find-module-rc-trigger5-2-0rc-trigger-or-its-corresponding-t

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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,
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...