3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

[メモ]tscで Cannot find module 'source-map'と出るとき

Posted at

問題

以下のコマンドを実行時にCannot find module 'source-map'と出る

tsc
エラー内容.bash

node_modules/@types/uglify-js/index.d.ts:9:30 - error TS2307: Cannot find module 'source-map'.

9 import { RawSourceMap } from 'source-map';
                               ~~~~~~~~~~~~

node_modules/@types/webpack-sources/index.d.ts:10:62 - error TS2307: Cannot find module 'source-map'.

10 import { SourceNode, RawSourceMap, SourceMapGenerator } from 'source-map';
                                                                ~~~~~~~~~~~~

node_modules/@types/webpack/index.d.ts:40:30 - error TS2307: Cannot find module 'source-map'.

40 import { RawSourceMap } from 'source-map';
                                ~~~~~~~~~~~~

解決策

以下を追記する。

tsconfig.json"
 "moduleResolution": "node"

解決にあたって参考にしたページ

Cannot find module 'source-map' · Issue #23649 · DefinitelyTyped/DefinitelyTyped

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?