在添加cordova-plugin-geofence时,出现以下错误
Cannot find module '../../src/cordova/platform_metadata'
Require stack:
- /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/Context.js
- /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js
- /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js
- /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/plugman.js
- /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/cordova-lib.js
- /usr/local/lib/node_modules/cordova/src/help.js
- /usr/local/lib/node_modules/cordova/src/cli.js
- /usr/local/lib/node_modules/cordova/bin/cordova
还有以下错误
Failed to install 'cordova-plugin-geofence': CordovaError: Version of installed plugin: "cordova-plugin-add-swift-support@2.0.2" does not satisfy dependency plugin requirement "cordova-plugin-add-swift-support@^1.6.0". Try --force to use installed plugin as dependency. at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js:544:43
答案 0 :(得分:0)
请遵循以下步骤
cordova platform remove ios
cordova plugin rm cordova-plugin-add-swift-support
cordova plugin add cordova-plugin-add-swift-support@1.6.0
cordova plugin rm cordova-plugin-geofence
cordova plugin add cordova-plugin-geofence
cordova platform add ios
cordova clean
让我知道它是否有效,如果您对答案满意,请投票。