1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

TS2307「Cannot find module ...」の原因と直し方(React + Vite / importパスの落とし穴)

Posted at

はじめに

作成中に以下のエラーが出ました

error TS2307: Cannot find module './components/InputForm' or its corresponding type declarations.

問題

このエラーの問題はファイル名/フォルダ名の大文字小文字が import と一致していないというものでした。
もともとファイル名がinputFormで、InputFormに修正し、コミットしました。
OS の大小文字の扱いの差で、変更が意図通りに反映されないみたいでした。
そのため、importでファイルが見つけられないとなったためです。

解決方法

1度InputForm_InputFormに変更しコミット。その後にInputFormに変更すればOKです。

おわりに

調べた感じ、MacとLinuxのOSの問題のようです。

参考

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?