无法更新到最新版本的cordova-ios

时间:2019-05-23 07:12:14

标签: google-maps cordova ionic-framework npm cordova-ios

我的应用程序是使用Ionic和Cordova构建的,包含GoogleMaps插件2.6.2(最新版本),但是一个月都没有在iOS上加载,并且Android仍然可以运行。

我只从同事那里购买过此产品,就Cordova,Ionic和npm而言,我是一个完全的初学者。无论如何,错误是不再安装插件(正如我的控制台在xCode中告诉我的那样)。当我尝试将Cordova-ios更新到最新版本(离子Cordova平台更新ios)时,我仅收到错误消息

> cordova platform update ios
Using cordova-fetch for cordova-ios@^5.0.0
Failed to fetch platform cordova-ios@^5.0.0
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 WARN @ ionic-native / google-maps @ 3.10.3 requires a peer of @ ionic-native / core @ ^ 3.6.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ ngx-translate / core @ 9.1.1 requires a peer of @angular / core @> = 5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN The package @ types / node is included as both a dev and production dependency.

npm ERR! path /path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim
npm ERR! code EEXIST
npm ERR! Refusing to delete /path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim: is outside /path/to/app/node_modules / cordova-ios / node_modules / ios-sim and not a link
npm ERR! File exists: /path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim
npm ERR! Move it away, and try again.

npm ERR! A complete log of this can be found in:
npm ERR! /path/to/app/.npm/_logs/2019-05-23T06_41_36_667Z-debug.log
[ERROR] An error occurred while running subprocess cordova.
        
        cordova update ios exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.

那到底是什么意思?我想卸载iOS平台(离子Cordova平台删除ios)并添加新平台(cordova平台添加ios@5.0.0),但是在卸载时已经出现以下错误:

ionic cordova platform remove ios
> cordova platform remove ios --save
Removing ios from cordova.platforms array in package.json
Error: npm: Command failed with exit code 1 Error output:
npm WARN @ionic-native/google-maps@3.10.3 requires a peer of @ionic-native/core@^3.6.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ngx-translate/core@9.1.1 requires a peer of @angular/core@>=5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN The package @types/node is included as both a dev and production dependency.

npm ERR! path /path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim
npm ERR! code EEXIST
npm ERR! Refusing to delete /path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim: is outside /path/to/app/node_modules/cordova-ios/node_modules/ios-sim and not a link
npm ERR! File exists: /path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim
npm ERR! Move it away, and try again.

npm ERR! A complete log of this run can be found in:
npm ERR!     /path/to/app/.npm/_logs/2019-05-23T07_05_52_055Z-debug.log
    at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-common/src/superspawn.js:125:23)
    at ChildProcess.emit (events.js:196:13)
    at maybeClose (internal/child_process.js:1011:16)
    at Socket.<anonymous> (internal/child_process.js:416:11)
    at Socket.emit (events.js:196:13)
    at Pipe.<anonymous> (net.js:586:12) {
  stderr: 'npm WARN @ionic-native/google-maps@3.10.3 requires a peer of ' +
    '@ionic-native/core@^3.6.0 but none is installed. You must install peer ' +
    'dependencies yourself.\nnpm WARN @ngx-translate/core@9.1.1 requires a ' +
    'peer of @angular/core@>=5.0.0 but none is installed. You must install ' +
    'peer dependencies yourself.\nnpm WARN The package @types/node is ' +
    'included as both a dev and production dependency.\n\nnpm ERR! path ' +
    '/path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim\n' +
    'npm ERR! code EEXIST\nnpm ERR! Refusing to delete ' +
    '/path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim: ' +
    'is outside ' +
    '/path/to/app/node_modules/cordova-ios/node_modules/ios-sim ' +
    'and not a link\nnpm ERR! File exists: ' +
    '/path/to/app/node_modules/cordova-ios/node_modules/.bin/ios-sim\n' +
    'npm ERR! Move it away, and try again.\n\nnpm ERR! A complete log of this ' +
    'run can be found in:\nnpm ERR!     ' +
    '/path/to/app/.npm/_logs/2019-05-23T07_05_52_055Z-debug.log\n',
  code: 1
}
[ERROR] An error occurred while running subprocess cordova.

        cordova platform remove ios --save exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.

我已经安装了以下插件:

> cordova plugin ls
cordova-plugin-datepicker 0.9.3 "DatePicker"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-geolocation 4.0.1 "Geolocation"
cordova-plugin-googlemaps 2.6.2 "cordova-plugin-googlemaps"
cordova-plugin-ionic-webview 4.0.1 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-whitelist 1.3.3 "Whitelist"
cordova-sqlite-storage 2.6.0 "Cordova sqlite storage plugin"
ionic-plugin-keyboard 2.2.1 "Keyboard"
phonegap-plugin-push 1.11.1 "PushPlugin"

我到底该怎么做才能将cordova-ios更新到最新版本?您还需要什么其他信息才能提供给您?我的Mac已经具有最新的操作系统。

编辑

我运行了rm -Rf platforms / node_modules / && npm install && ionic cordova platform add ios @ latest,现在在控制台上得到以下输出。

> fsevents@1.2.9 install / path / to / app / node_modules / fsevents
> node install

node-pre-gyp WARN Using request for node-pre-gyp https download
[fsevents] Success: "/path/to/app/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node" is installed via remote

> node-sass@4.12.0 install / path / to / app / node_modules / node-sat
> node scripts / install.js

Cached binary found at /path/to/app/.npm/node-sass/4.12.0/darwin-x64-72_binding.node

> uglifyjs-webpack-plugin@0.4.6 postinstall / path / to / app / node_modules / uglifyjs-webpack-plugin
> node lib / post_install.js


> node-sass@4.12.0 postinstall / path / to / app / node_modules / node-sass
> node scripts / build.js

Binary found at /path/to/app/node_modules/node-sass/vendor/darwin-x64-72/binding.node
Testing binary
Binary is fine
npm WARN The package @ types / node is included as both a dev and production dependency.

added 1330 packages from 1442 contributors in 63.504s
> cordova platform add ios @ latest --save
Using cordova-fetch for cordova-ios @ latest
Adding ios project ...
Creating Cordova project for the iOS platform:
Path: platforms / ios
Package: com.gpsno
Name: GPS-No.com
iOS project created with cordova-ios@5.0.1
Installing "cordova-plugin-datepicker" for ios
Installing "cordova-plugin-device" for ios
Installing "cordova-plugin-geolocation" for ios
Installing "cordova-plugin-googlemaps" for ios
"framework" tag with type "podspec" is deprecated and will be removed. Please use the "podspec" tag.
cordova-plugin-googlemaps depends on GoogleMaps @ ~> 2.7.0, which conflicts with another plugin. GoogleMaps @ ~> 3.1.0 is already installed and was not overwritten.
Running command: pod install --verbose

      Official document https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.6.0/README.md Please consider buying beer for us  https://github.com/mapsplugin/ cordova-plugin-google maps # buy-us-a-beer
    
Installing "cordova-plugin-ionic-webview" for ios
Installing "cordova-plugin-splashscreen" for ios
Installing "cordova-plugin-statusbar" for ios
Installing "cordova-plugin-whitelist" for ios
Installing "cordova-sqlite-storage" for ios
Failed to install 'cordova-sqlite-storage': CordovaError: Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
    at Context.requireCordovaModule (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/Context.js:57:15)
    at module.exports (/path/to/app/plugins/cordova-sqlite-storage/scripts/beforePluginInstall.js:13:21)
    at runScriptViaModuleLoader (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32)
    at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20
    at processTicksAndRejections (internal / process / task_queues.js: 89: 5)
Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.
[ERROR] An error occurred while running subprocess cordova.
        
        cordova platform add ios @ latest --save exited with exit code 1.
        
        Re-running this command with the --verbose flag may provide more information.

看来一切都解决了。我是否需要担心消息

cordova-plugin-googlemaps depends on GoogleMaps @ ~> 2.7.0, which conflicts with another plugin. GoogleMaps @ ~> 3.1.0 is already installed and was not overwritten.

如果可以,我该怎么做或删除?

我该如何解决问题

Installing "cordova-sqlite-storage" for ios
Failed to install 'cordova-sqlite-storage': CordovaError: Using "requireCordovaModule" to load non-cordova module "q" is not supported. Instead, add this module to your dependencies and use regular "require" to load it.

1 个答案:

答案 0 :(得分:2)

  

为ios安装“ cordova-sqlite-storage”      无法安装“ cordova-sqlite-storage”:CordovaError:不支持使用“ requireCordovaModule”加载非cordova模块“ q”。取而代之的是,将此模块添加到您的依赖项中,并使用常规的“ require”进行加载。

这是因为您已经安装了cordova@9.0.0的CLI(由第三方插件removed support for use of requireCordovaModule),但是安装了旧版本的cordova-sqlite-storage插件并使用了requireCordovaModule。因此,您需要更新cordova-sqlite-storage插件的版本:

cordova plugin rm cordova-sqlite-storage && cordova plugin add cordova-sqlite-storage@latest
  

cordova-plugin-googlemaps取决于GoogleMaps @〜> 2.7.0,它与另一个插件冲突。 GoogleMaps @〜> 3.1.0已经安装并且未被覆盖。

再次可能是由于cordova-plugin-googlemaps的版本过旧,所以请对其进行更新:

cordova plugin rm cordova-plugin-googlemaps --nosave && cordova plugin add cordova-plugin-googlemaps@latest

请注意,在删除插件以保留任何包含API密钥的插件变量时,请使用--nosave选项。

您还应该检查并更新项目中的其他插件。一种简单的方法是使用cordova-check-plugins工具:

npm install -g cordova-check-plugins
cordova-check-plugins --unconstrain-versions --update=auto
# or --update=interactive for interactive update process

免责声明:我是cordova-check-plugins

的作者

当更新插件时,请注意主要版本更新可能包含应用程序使用的API的重大更改,因此,您应该注意以下几点: 检出要为其更新主版本的插件的更改日志或提交历史记录,并在应用程序中进行任何必要的API更改。