Skip to content
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

Visual Studio cannot find Typescript declaration file 'source-map' #449

Open
Edminsson opened this issue Dec 2, 2021 · 3 comments
Open

Comments

@Edminsson
Copy link

I'm getting this error in Visual Studio 2019 :

Error TS6053 File 'path-to-my-project/node_modules/source-map/source-map' not found.
The file is in the program because: Root file specified for compilation

The cause of this error seems to be this line in package.json:
"typings": "source-map",
If i change it to
"typings": "source-map.d.ts",
then everythings works fine.

@oliverjam
Copy link

oliverjam commented Feb 7, 2022

Looks like this was fixed in 2018. I had the same error; one of my dependencies depends on a much older version of source-map. It's probably fixable by using "overrides" in your package.json (as of npm version 8) to set a newer version of this library.

@jordanbtucker
Copy link

jordanbtucker commented Feb 24, 2022

For me, this issue was occurring because @babel/generator still uses source-map@^0.5.0. They actually bumped the version two years ago, but then reverted it due to a regression (rather than fixing their codebase to work with the new version of source-map).

See: babel/babel#12025

If you run npm ls source-map you can see the tree of which packages are dependent upon it. Here's what mine looks like:

└─┬ tap@15.0.10
  ├─┬ import-jsx@4.0.0
  │ └─┬ @babel/core@7.15.5
  │   ├─┬ @babel/generator@7.15.4
  │   │ └── source-map@0.5.7 deduped
  │   └── source-map@0.5.7
  ├─┬ nyc@15.1.0
  │ ├─┬ istanbul-lib-instrument@4.0.3
  │ │ └─┬ @babel/core@7.14.8
  │ │   ├─┬ @babel/generator@7.14.8
  │ │   │ └── source-map@0.5.7 deduped
  │ │   └── source-map@0.5.7
  │ └─┬ istanbul-lib-source-maps@4.0.0
  │   └── source-map@0.6.1
  └─┬ source-map-support@0.5.19
    └── source-map@0.6.1

@jordanbtucker
Copy link

Maybe the fix can be backported into ^0.5 and ^0.6. I think this repo would need to create a branch for each of those minor versions before I could create a PR for them though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants