Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

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

reactjs - TS2307: Cannot find module '_rc-trigger@5.2.0@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 '_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"]
}
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 Reply

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...