Typeorm Error - Cannot find module
28 Feb 2024在寫完 seed file 做執行的時候,卻出現下列錯誤:
Error: Cannot find module
這是因為在 seed.ts 內引入 entity 時的路徑關係 正確寫法:
import Flight from '../entity/Flight'
錯誤寫法:
import Flight from 'db/entity/Flight'
應使用相對路徑而非絕對路徑。
在寫完 seed file 做執行的時候,卻出現下列錯誤:
Error: Cannot find module
這是因為在 seed.ts 內引入 entity 時的路徑關係 正確寫法:
import Flight from '../entity/Flight'
錯誤寫法:
import Flight from 'db/entity/Flight'
應使用相對路徑而非絕對路徑。
在執行 mvn install
的時候,會跳出下面 Error:
maven is present in the local repository, but cached from a remote repository ID that is unavailable in current build context
解決辦法
至有問題的 package 資料夾底下,刪除 _remote.repositories
這個檔案。
好久沒更新頁面了!最近在學 java,所以紀錄會偏向 java 與 spring boot 的學習!
touch HelloWorld.java
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
javac HelloWorld.java
java HelloWorld
Solution: 按下電腦的 CTRL + Shift + P 後,輸入 java clean 選擇 Java: Clean the Java language server workspace,接著就會刪除 language server workspace 重新啟動 IDE。