Ionic3项目添加平台/插件失败:Cordova不识别add命令求助
Alright, let's get this sorted out. The error you're hitting is a straightforward command syntax mistake—here's how to fix it step by step:
The error message Cordova does not know add tells us exactly what's wrong: you're using an invalid Cordova command structure. cordova add platform isn't a valid command—Cordova expects you to specify the target (like platform or plugin) first, followed by the action (like add).
1. Correct the Platform Add Command
Replace your incorrect command:
cordova add platform
With the proper syntax (using Android as an example; swap with ios if needed):
# Pure Cordova command cordova platform add android # Or use the Ionic-wrapped command (better for Ionic 3 projects) ionic cordova platform add android
2. Validate the Plugin Install Command
Your plugin install command syntax is actually correct, but if you still run into issues after fixing the platform command, try re-running it after ensuring your Cordova environment is stable:
ionic cordova plugin add https://github.com/moust/cordova-plugin-videoplayer.git
3. Extra Troubleshooting (If Issues Persist)
- Check your Cordova version to ensure it's compatible with Ionic 3 (Ionic 3 works best with Cordova 8.x to 9.x):
cordova -v - Clear Cordova's cache to eliminate any cached corruption:
cordova clean - If all else fails, reset your platforms and plugins folders (they can sometimes get corrupted):
# Delete the problematic folders rm -rf platforms plugins # Re-add your platform and plugin ionic cordova platform add android ionic cordova plugin add https://github.com/moust/cordova-plugin-videoplayer.git
内容的提问来源于stack exchange,提问作者Shweta Khera

