Open cengit opened 1 year ago
root cause is: there is lower typescript version dependency in the third party libs.
see this is my project package.json
"dependencies": {
"@types/express-serve-static-core": "^4.17.33",
"react": "16.13.1",
"react-native": "0.63.4",
"react-native-monorepo-tools": "^1.1.4",
"typescript": "^4.9.5",
"yarn-work-space-demo": "ssh://code.pruconnect.net:7999/~xiongbo.cen_prudential.com.cn/yarn-work-space-demo.git",
"use-low-typescript-version": "ssh://git@github.com:cengit/use-low-typescript-version.git"
}
"resolutions": {
"typescript": "^4.9.5" // did not work here
},
"overrides": {
"typescript": "^4.9.5" // did not work here either
}
use-low-typescript-version project package.json
"devDependencies": {
"@commitlint/config-conventional": "^8.3.4",
"@react-native-community/bob": "^0.16.2",
"@react-native-community/eslint-config": "^2.0.0",
"@release-it/conventional-changelog": "^1.1.4",
"@types/jest": "^26.0.0",
"@types/react": "^16.9.19",
"@types/react-native": "0.62.13",
...
"typescript": "^3.8.3" // **** see the devil is here ****
}
how to fix: just change the use-low-typescript-version project package.json "typescript": "^3.8.3"
to "typescript": "^4.9.5"
fixing:
"devDependencies": {
"@commitlint/config-conventional": "^8.3.4",
"@react-native-community/bob": "^0.16.2",
"@react-native-community/eslint-config": "^2.0.0",
"@release-it/conventional-changelog": "^1.1.4",
"@types/jest": "^26.0.0",
"@types/react": "^16.9.19",
"@types/react-native": "0.62.13",
...
"typescript": "^4.9.5" // **** update the version fix the issue ****
}
how to locate the lib which having the lower version of typescript?
see the error message:
Error: Failed to build definition files.
at build (/Users/cen/Library/Caches/Yarn/v6/.tmp/091f62b39b416fea18d958e1e47fa3bb.48ceed475233cc30f0b9d9f9cc4ad31181860ed6.prepare/node_modules/@react-native-community/bob/lib/targets/typescript.js:112:11)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
go to node_modules
path in above error message: /Users/cen/Library/Caches/Yarn/v6/.tmp/091f62b39b416fea18d958e1e47fa3bb.48ceed475233cc30f0b9d9f9cc4ad31181860ed6.prepare/node_modules/
and then open the typescript/package.json
under this dir, it is:
/Users/cen/Library/Caches/Yarn/v6/.tmp/091f62b39b416fea18d958e1e47fa3bb.48ceed475233cc30f0b9d9f9cc4ad31181860ed6.prepare/node_modules/typescript/package.json
this is the typescript/package.json:
{
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
"version": "3.9.7", // *** devil here ****
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
"TypeScript",
"Microsoft",
"compiler",
"language",
"javascript"
],
"bugs": {
"url": "https://github.com/Microsoft/TypeScript/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/Microsoft/TypeScript.git"
}
it only took me A-WHOLE-SINGLE-DAY to find out this shit....
error like this