我首先使用以下命令将android平台添加到了我的应用中:
ionic cordova platform add android
它工作正常,但是当我尝试添加ios时,遇到了以下问题:
cordova platform add ios --save
Using cordova-fetch for cordova-ios@0.0.1
Failed to fetch platform cordova-ios@0.0.1
Probably this is either a connection problem, or platform spec is
incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for cordova-ios@0.0.1
npm ERR! notarget In most cases you or one of your dependencies
are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tejashripatange/.npm/_logs/2019-03-
27T16_40_10_705Z-debug.log
[ERROR] An error occurred while running subprocess cordova.
cordova platform add ios --save exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
此外,它还生成了如下的日志文件:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli 'cordova-ios@0.0.1',
1 verbose cli '--production',
1 verbose cli '--save-exact' ]
2 info using npm@6.4.1
3 info using node@v10.14.2
4 verbose npm-session 6aad67a67d24ca34
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/cordova-ios 172ms (from cache)
8 silly registry:manifest no matching version for cordova-ios@0.0.1 in the cache. Forcing revalidation
9 http fetch GET 304 https://registry.npmjs.org/cordova-ios 54ms (from cache)
10 silly fetchPackageMetaData error for cordova-ios@0.0.1 No matching version found for cordova-ios@0.0.1
11 timing stage:rollbackFailedOptional Completed in 0ms
12 timing stage:runTopLevelLifecycles Completed in 1144ms
13 verbose type version
14 verbose stack cordova-ios: No matching version found for cordova-ios@0.0.1
14 verbose stack at pickManifest (/usr/local/lib/node_modules/npm/node_modules/npm-pick-manifest/index.js:65:11)
14 verbose stack at fetchPackument.then.packument (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/manifest.js:52:18)
14 verbose stack at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
14 verbose stack at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
14 verbose stack at Promise._settlePromise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
14 verbose stack at Promise._settlePromise0 (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
14 verbose stack at Promise._settlePromises (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18)
14 verbose stack at Async._drainQueue (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:16)
14 verbose stack at Async._drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
14 verbose stack at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
14 verbose stack at runCallback (timers.js:705:18)
14 verbose stack at tryOnImmediate (timers.js:676:5)
14 verbose stack at processImmediate (timers.js:658:5)
15 verbose cwd /Users/tejashripatange/Downloads/KGKLive
16 verbose Darwin 18.2.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "cordova-ios@0.0.1" "--production" "--save-exact"
18 verbose node v10.14.2
19 verbose npm v6.4.1
20 error code ETARGET
21 error notarget No matching version found for cordova-ios@0.0.1
22 error notarget In most cases you or one of your dependencies are requesting
22 error notarget a package version that doesn't exist.
23 verbose exit [ 1, true ]
它实际上曾经可以工作,但不知道为什么它不生成平台。
答案 0 :(得分:1)
由于某种原因,似乎Cordova尝试安装cordova-ios@0.0.1
,该命令不存在。您应该检查一下是否在某处对此有参考。
尝试改为显式设置版本:
cordova platform add ios@5.0.0 --save