Error generating (iOS), the 'semver' node module in a plugin hook was missing
Application Type
Mobile
Platform Version
11.9.0 (Build 17011)

Hi Outsystems forum,

Recently I've got this message when generating iOS native platform of our mobile app project. The error log said: 

Error: Error installing a Cordova plugin. Due to security concerns, the required dependency for the 'semver' node module in a plugin hook was missing. For more details, check the product documentation on how to ensure your plugins node dependencies. 

I've tried to do some research to find similar issue, like on this thread: https://www.outsystems.com/forums/discussion/67469/semver-cordova-plugin-add-swift-support-getting-issue-while-generating-ios/

But we don't use Swift Support plugin so I'd think it's from the other plugin (or else).

Here's the detailed error log:


Could it be another plugin that caused this? Do we need to change MABS version? Unfortunately it's not stated in the error log. We are using MABS Version 6.3 for the mobile app

Dear Aditya,

It seems like your application is indeed using a reference of the swift support plugin or there is any other component, which is used in your application, where the Swift Support plugin is has been added as a reference.

  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] No scripts found for hook "before_plugin_add".
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Calling plugman.fetch on plugin "https://github.com/DavidSousa/cordova-plugin-add-swift-support#v1.0"
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Fetching plugin "https://github.com/DavidSousa/cordova-plugin-add-swift-support" via git clone

Now to fix this issue, you have to follow the below steps:

1. Open the swift support plugin and modify the git path in the extensibility configuration of that plugin to the below path:

 https://github.com/DavidSousa/cordova-plugin-add-swift-support#v1.1 

and publish it. It seems like the plugin is using an old version of code from the git hub. The developer has modified it recently. Please refer to the answer marked as solution at [Swift Support Plugin] [semver] cordova-plugin-add-swift-support getting issue while generating iOS | OutSystems 

2. Refresh the dependencies of all other cordova plugins whose reference you are using in your application, as you do not know which component is using the swift support plugin.

3. Refresh the dependency of your main application, publish it and then try to generate the app again.


Hope this helps.

Cheers !

Shounak

Dear Aditya,

Are you using any other cordova plugin in your application? It is not clear from your screenshot about other cordova plugins you are using.

Regards,

Shounak

yes, we uses various cordova plugin in our app. this is the Error build log from service center:


  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] No scripts found for hook "before_plugin_add".
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Calling plugman.fetch on plugin "https://github.com/DavidSousa/cordova-plugin-add-swift-support#v1.0"
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Fetching plugin "https://github.com/DavidSousa/cordova-plugin-add-swift-support" via git clone
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Running command: git clone https://github.com/DavidSousa/cordova-plugin-add-swift-support /var/tmp/builder01/git/1611213431163
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Command finished with error code 0: git clone,https://github.com/DavidSousa/cordova-plugin-add-swift-support,/var/tmp/builder01/git/1611213431163
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Running command: git checkout v1.0
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Command finished with error code 0: git checkout,v1.0
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Repository "https://github.com/DavidSousa/cordova-plugin-add-swift-support" checked out to git ref "v1.0".
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Copying fetched plugin over "/private/var/lib/builder01/builds/c4059375-7ddc-4b80-91fb-69dc06a2ec21/source/plugins/cordova-plugin-add-swift-support"...
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Plugin "cordova-plugin-add-swift-support" fetched.
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Calling plugman.install on plugin "/private/var/lib/builder01/builds/c4059375-7ddc-4b80-91fb-69dc06a2ec21/source/plugins/cordova-plugin-add-swift-support" for platform "ios
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Installing "cordova-plugin-add-swift-support" for ios
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Running command: /private/var/lib/builder01/builds/c4059375-7ddc-4b80-91fb-69dc06a2ec21/source/platforms/ios/cordova/version 
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Command finished with error code 0: /private/var/lib/builder01/builds/c4059375-7ddc-4b80-91fb-69dc06a2ec21/source/platforms/ios/cordova/version 
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Finding scripts for "before_plugin_install" hook from plugin cordova-plugin-add-swift-support on ios platform only.
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] No scripts found for hook "before_plugin_install".
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Install start for "cordova-plugin-add-swift-support" on ios.
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] PlatformApi successfully found for platform ios
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Beginning processing of action stack for ios project...
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Action stack processing complete.
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] pods.json found in platforms/ios
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Podfile found in platforms/ios
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Install complete for cordova-plugin-add-swift-support on ios.
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Finding scripts for "after_plugin_install" hook from plugin cordova-plugin-add-swift-support on ios platform only.
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] No scripts found for hook "after_plugin_install".
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Adding cordova-plugin-add-swift-support to package.json
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Saved plugin info for "cordova-plugin-add-swift-support" to config.xml
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Executing script found in plugin cordova-plugin-add-swift-support for hook "after_plugin_add": plugins/cordova-plugin-add-swift-support/src/add-swift-support.js
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Error: Cannot find module 'semver'
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Require stack:
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] - /private/var/lib/builder01/builds/c4059375-7ddc-4b80-91fb-69dc06a2ec21/source/plugins/cordova-plugin-add-swift-support/src/add-swift-support.js
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] - /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] - /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] - /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/plugman.js
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] - /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/cordova-lib.js
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] - /usr/local/lib/node_modules/cordova/src/help.js
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] - /usr/local/lib/node_modules/cordova/src/cli.js
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] - /usr/local/lib/node_modules/cordova/bin/cordova
  • [2021-01-21T07:17:13.804Z] [ERROR] [Build] Build failed with the following error: Error installing a Cordova plugin. Due to security concerns, the required dependency for the 'semver' node module in a plugin hook was missing. For more details, check the product documentation on how to ensure your plugins node dependencies.

Dear Aditya,

It seems like your application is indeed using a reference of the swift support plugin or there is any other component, which is used in your application, where the Swift Support plugin is has been added as a reference.

  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] No scripts found for hook "before_plugin_add".
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Calling plugman.fetch on plugin "https://github.com/DavidSousa/cordova-plugin-add-swift-support#v1.0"
  • [2021-01-21T07:17:13.803Z] [ERROR] [Build] Fetching plugin "https://github.com/DavidSousa/cordova-plugin-add-swift-support" via git clone

Now to fix this issue, you have to follow the below steps:

1. Open the swift support plugin and modify the git path in the extensibility configuration of that plugin to the below path:

 https://github.com/DavidSousa/cordova-plugin-add-swift-support#v1.1 

and publish it. It seems like the plugin is using an old version of code from the git hub. The developer has modified it recently. Please refer to the answer marked as solution at [Swift Support Plugin] [semver] cordova-plugin-add-swift-support getting issue while generating iOS | OutSystems 

2. Refresh the dependencies of all other cordova plugins whose reference you are using in your application, as you do not know which component is using the swift support plugin.

3. Refresh the dependency of your main application, publish it and then try to generate the app again.


Hope this helps.

Cheers !

Shounak

Hi Shounak, 

Thank you, it's working as expected :) marked your post as solution. Once again thank you for your help.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.