Ionic Cordova构建Android报错:找不到../pages/Wallet/模块求解决
Hey there, let's fix this module not found error you're hitting! The root cause here is actually Linux's case-sensitive file system—something that's easy to miss if you developed this project on Windows (which ignores case in file paths).
What's going wrong?
Looking at your error logs:
- In
app.component.ts, you're importing from../pages/Wallet/ - In
app.module.ts, you're importing from../pages/Wallet/wallet
But on your Ubuntu instance, the actual folder is almost certainly named wallet (lowercase), not Wallet (uppercase). Since Linux treats Wallet and wallet as two completely different paths, TypeScript can't locate the module. Removing/re-adding the Android platform won't fix this because it's a file path mismatch, not a Cordova platform issue.
Step-by-step fix
Verify the actual folder name
Run this command in your project root to check the exact name of the folder:ls -la src/pages/You'll likely see a
walletfolder (all lowercase) instead ofWallet.Fix the import paths
Update the import statements to match the actual folder's case:- In
src/app/app.component.ts, change line 12 to:import {WalletPage} from '../pages/wallet/'; - In
src/app/app.module.ts, change line 15 to:import {WalletPage} from '../pages/wallet/wallet';
- In
Check for other case mismatches
Do a quick search across your project to make sure there are no other places where you've usedWalletinstead ofwallet(like route configurations, other component imports, etc.). You can use this command to find all instances:grep -r "../pages/Wallet" src/Clean and rebuild
Clear any cached build files and try building again:ionic cordova clean android ionic cordova build android
That should resolve the module not found errors—this is a super common gotcha when moving projects from Windows to Linux environments!
内容的提问来源于stack exchange,提问作者Ashish Karpe

