我在爲我的cordova項目添加android平臺時遇到問題。所有需要的東西都已經安裝。我有jdk,sdk for android,npm,git和cordova。所有最新版本截至2017年6月14日。我可以用命令cordova create myapp
創建cordova項目。無法從cordova CLI向cordova項目添加android平臺
但是,成功創建應用程序後,當我從myapp文件夾中運行cordova platform add android
後,出現錯誤。我嘗試了一切,但無法完成。我已經設置了ANDROID_HOME,添加了Android SDK工具和平臺工具目錄到PATH,使用了--nofetch
但無濟於事。
下面是我跑我的命令cordova platform add android
Using cordova-fetch for [email protected]~6.2.2
Error: Failed to fetch platform [email protected]~6.2.2
Probably this is either a connection problem, or platform spec is incorrect. Check your connection and platform name/version/URL.
Error: cmd: Command failed with exit code 1
Error output: npm ERR! shasum check failed for
C:\Users\PARAS~1.SHA\AppData\Local\Temp\npm-3048-83f48a6f\registry.npmjs.org\cordova-android\-\cordova-android-6.2.3.tgz
npm ERR! Expected: 249f21b6ce5f1f1c847a7ab83b16909dbed5aa28
npm ERR! Actual: ace33a120d0172a175c73e708f0552cc205731b0
npm ERR! From: http://registry.npmjs.org/cordova-android/-/cordova-android-6.2.3.tgz
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\paras.sharma\AppData\Roaming\npm-cache\_logs\2017-06-14T11_09_17_075Z-debug.log
嘗試:'cordova platform add android @ latest' – Joerg
與「cordova platform add android @ latest」完全相同的結果也是 – hardeep