-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error TS2688: Cannot find type definition file for...random paths. #27956
Comments
These errors occur when you have subdirectories of a In your case, the errors occur because your |
Aha! Doh! My apologies, clearly that's a yarn add gone wrong. Yes, very silly indeed. Feel free to use my blunder-ticket to track improving any feedback 😉 |
Proposed new errors:
(Of course, the long link could be replaced with an aka.ms link.) |
In my situation, how was the directory |
TypeScript looks in |
So how does that connect back to there being a bad |
The entry |
Aha! Gotcha. After reading your error messages, I wasn't so sure they'd have helped me figure out what was going on either. So, I was trying to think if there's any way to highlight not necessarily the source of my error, but better information about the symptom. |
I got this problem too and my case is different. My project has the following file structure:
The frontend working directory is
And then when I ran I fixed the error by deleting the |
Exact same thing happened to me as @mattmccutchen describes. Also ran |
it help me a lot, thank you. |
So.. what's the best strategy to tackle the need for I am not really happy with the empty index file strategy, but it seems to help - otherwise I simply can't have a bunch of smaller d.ts files in my project's |
Within the Typescript documentation with the section on compiler options 'types', it worked for me |
This is what I used that appears to remedy this type of error for me. |
Sorry for do not having time read through all comments here.
|
Ok. Thanks for your feedback. If you solved your problem, then why are you
telling me?
Why not just published it as a check that developers need to ascertain and
forget it?
…On Wed, Jan 8, 2020 at 5:18 AM Su ***@***.***> wrote:
Sorry for having time read through all comments here.
I think this error just indicated you:
"if you config tsc to do the job in this way, you need to install the
missing type definitions for the modules that tsc indicate. For Example, in
my scenario, tsc told me I'm missing type definition for "node", then I
solve it by yarn add -D @types/node`. 🧀
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#27956?email_source=notifications&email_token=ANU7JYM5YEZ6BALZNRKDJVTQ4WY77A5CNFSM4F5Q5E6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIMBYAA#issuecomment-572005376>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANU7JYO4AGMPKVMCXJQPE2TQ4WY77ANCNFSM4F5Q5E6A>
.
|
This should probably be a warning rather than an error. A missing typedef is equivalent to an empty typedef, which isn't an error condition. |
* Allow core to be built on latest node version - Use `>12` instead of `^12` * Add quotes to copyfiles in package.json - On MacOS the quotes are necessary - Result is that ttf and img files don't get moved to /react dist folder - import error on "./fonts/font-finance.ttf" * Proper quoting of package.json commands - Turns out that single quotes work on Mac but not Windows - \" is the cross-platform way to quote - Use \\\" to include a quote within a quoted argument! (none in here but FYI) - Ultimately this is super-fragile. This build code should be moved downward into localized node code (gulp, node or cli) * Updated yarn.lock from dependency changes * Added comments to readme for future build strategy - placeholder, project was deadended because of timelines * Blank index.d.ts files to work around tsc idiosyncracy - microsoft/TypeScript#27956 - Was throwing tsc errors that caused build to break in production mode * Refactor of core build process - Simplified package.json - DRY webpack configs - Cleaned up readme * Dummy index.d.ts files in package.json - For tsc idiosyncracy * Added standalone "launch" to seed - Launches finsemble without build or server * Removed duplicate function call - Caused webpack to break in production mode * Added error output to seed webpack - Needed to read "stats" object for errors - Commented out warnings because we have too many to resolve right now * Added top level prod build to monorepo - `yarn prod` to run in production - Non-parallelized build. Total refactor needed to do otherwise. * Eliminated packaged finsemble.css in favor of files - Bug in mini-css-export-plugin was maddening - Decided to caveman the problem and just copy files from node_modules into assets - In the end, this is more web and less webpack, so better and faster - Work being done in CopyWebpackPlugin but ought to be refactored because it's not really a webpack task at all. * Remove "finsemble" and "installer-tmp" on clean - installer-tmp can get left hanging around - finsemble will get copied again with next build * Caching for production mode is now zero - This was tripping us up over and over in development - If you ran production mode just once, then no code changes would take effect for 24 hours - Instead, we added some guidance on setting up production mode as comments within the file
I have fixed this by adding |
i have the same error but on jsconfig.json file, for no aparent reason, i don't use babel or any other transpiler on my project, because its a very simple static website, and this is what i have on my jsconfig file, and it's reporting an "unexpected" error, i don't use babel, or any other transpiler, how can i get rid of this error? or is this a bug? |
vscode 1.5.0 |
I had a similar problem in a project where a library added native types, fixed by removing its @types/ lib. In my case the library was yup, so removing @types/yup fixed the error. Typescript authors: the error message is not helpful. It would be nice to detect overlapping types and give an error about a conflict, perhaps like "Try removing the @types library if one is installed". 👍 |
Thanks! Had the same problem with |
JUST FYI for Everyone: I found this thread reading having this same issues. But in mine i had removed the library and @type file as no longer needed. I was still getting this error. Restarting VSCODE and it went away |
As @mosesoak said, it's because you have types for packages that you don't even use in So first of all try to remove those packages or try removing If that doesn't help, go for other options like |
For me None of the above solutions worked!
Fix: Remove the keyv folder from node_modules/@types and try to build again! It worked for me! |
This is what worked for me: #27956 (comment) The rogue node_modules folder was in the great-grandparent directory. Took me just about 2 hours to figure out 😢 🤣 |
Missing index.d.ts unnecessarily broke a chunk of the internet: "This should be a warning", he says again 2 years later. |
Thank you |
This worked for me. Thank you! |
O mesmo erro aconteceu comigo, nisso ao ler esse fórum inclui a opção 2 do nosso amigo acima e deu super certo, obrigada! Opção 2: adicionar typeRoots em "compilerOptions" em seu tsconfig.json { |
I don't know why this error comes up, can't there be no need for node_modules to be defined type by default? Does it have to have |
Initially I ran into the same problem. My However, if I thoroughly follow the instructions for "Nuxt 3 getting-started" which is where this error appeard for me, the error clears up. There it recommends to use a Plugin I think the important part is Found in here in https://nuxt.com/docs/getting-started/installation#prerequisites which leads to https://vuejs.org/guide/typescript/overview.html#volar-takeover-mode After enabling Maybe there are similar conflicts with Plugins for your Frameworks or disabling |
fixed my strapi |
This worked for me |
a VSCODE restarting fixed the errors...thank you. |
That's the only way that works for me. I tried all other ways above, but none of them worked. Big thanks! |
@houh60 damn. it worked for me too LOL! Sometimes modern problems required not-so-modern solutions. |
This also happens after upgrading to 5.1 |
This is turning into a random support thread which is not the intention of the issue tracker. I'm not seeing a putatitive defect here - please seek support in other fora if needed. |
Using https://github.com/atrauzzi/gerty on the branch
hashi-gerty
.Basically anything that tries to do typescript gets a bunch of errors about not finding type definitions I never reference in any of my source files.
(For the simplest example, I do a
yarn install
and then./node_modules/.bin/ts-node
.)Apologies, I have searched for this, but wasn't able to find anything relevant or within the last few months.
What is happening and why am I getting these weird errors? Is there any way they can be improved if it is in fact something that I've done wrong?
The text was updated successfully, but these errors were encountered: