If you know how to fix the issue, make a pull request instead.
@types/webpack
| @types/html-webpack-plugin
package and had problems.Definitions by:
in index.d.ts
) so they can respond."dependencies": {
"@types/html-webpack-plugin": "^2.30.2",
"@types/node": "^9.4.5",
"@types/webpack": "^3.8.7"
},
"devDependencies": {
"@types/jquery": "^3.3.0",
"@types/lodash": "^4.14.102",
"html-webpack-plugin": "^2.30.1",
"jquery": "^3.3.1",
"lodash": "^4.17.5",
"ts-loader": "^3.5.0",
"typescript": "^2.7.1",
"webpack": "^3.11.0"
},
This happens after installing the following package:
npm install @types/webpack
or this package:
npm install @types/html-webpack-plugin
PS C:\inetpub\wwwroot\WebPack_TypeScript_Setup_Example> tsc
node_modules//index.d.ts(9,32): error TS2307: Cannot find module 'source-map'.
node_modules//index.d.ts(20,30): error TS2307: Cannot find module 'source-map'.
@j-oliveras told me to try this:
npm install @types/[email protected]
Now I don't get these errors anymore, but if I install the latest version of source-map
the problem returns !
Happened to me too, if I install the latest @types/source-map
, i get the following errors:
ERROR in <PATH_TO_PROJECT>/node_modules/@types/uglify-js/index.d.ts(9,32):
TS2307: Cannot find module 'source-map'.
ERROR in <PATH_TO_PROJECT>/node_modules/@types/webpack/index.d.ts(20,30):
TS2307: Cannot find module 'source-map'.
if I install @types/[email protected]
, the problem goes away.
The same problem here! Thank you @GabrielDuarteM
Any updates on this ? @rbuckton , @jvilk , adding @tkrotoff
I get this error constantly when creating a new project:
node_modules/
@types/uglify-js
/index.d.ts(9,32): error TS2307: Cannot find module 'source-map'.
node_modules/@types/webpack
/index.d.ts(23,30): error TS2307: Cannot find module 'source-map'.
source-map
ships with its own types from 0.5.7 on.
Here's what I think will work, but have not tested:
source-map
version 0.5.7 or above (e.g. source-map
is in your dependencies/devDependencies), then do not install @types/source-map
; source-map
ships with its own types.source-map
, then I believe you should be able to either install @types/source-map
or source-map
to resolve the problem, but don't install both.Does that help at all?
I just tried to install source-map 0.5.7 and have the errors described. Perhaps it's a problem downstream with uglify and webpack types
Problem is fixed when installing: "source-map": "^0.7.2",
@Legends the issue still remains for me when installing "source-map": "^0.7.2"
. If I install just @types/[email protected]
(just the typing, without the source-map
package, as I don't use it anywhere) the problem goes away, but if I uninstall the types, the same error comes back.
Reopening the issue as @GabrielDuarteM still has problems...
Does it make sense to need to install the types for a module you don't directly depend on? Shouldn't @types/webpack
just depend on it explicitly if it actually needs them?
The issue have raise when install latest version 0.5.7 of @types/source-map
. 0.5.2 is ok.
I fixed it like this:
source-map
npm install source-map --save-dev
moduleResolution
to node
in tsconfig.json
{
"compilerOptions": {
"moduleResolution": "node"
}
}
@GabrielDuarteM Still an issue or can I close it?
@Legends I'm still having the issue.
I'm having the same issue too.
yarn add --dev @types/[email protected]
fixes it like @GabrielDuarteM said
Same here -- npm install --save --dev @types/[email protected]
worked for me.
Thank @zeronight.
tsc [...] --moduleResolution node
worked.
In my case, there was no need to neither source-map
nor @types/source-map
.
Same here --
npm install --save --dev @types/[email protected]
worked for me.
this fixed it for me , too. why isnt this fixed by now??
after upgrading to angular 9
i did npm install --save --only=dev @types/[email protected]
and the error didnt go away,
Solution
ended up removing --save --only=dev and did
npm install @types/[email protected]
which worked perfectly
Most helpful comment
I fixed it like this:
source-map
moduleResolution
tonode
intsconfig.json