I want to do something after plugin is removed.
I have tried to use after_plugin_rm hook in "plugin.xml" but it did not work.
What is expected to happen?
Script for after_plugin_rm need to be executed
What does actually happen?
No scripts found for hook after_plugin_rm.
Information
Scripts for hooks(after_plugin_add 、 before_plugin_rm and before_plugin_uninstall) are all performed normally.
After removing the plugin, the commandline outputs 'No scripts found for hook "after_plugin_rm"'
I think It may be caused by the plugin code(include the script for "after_plugin_rm" hook) being removed before "after_plugin_rm" hook.
Installing "com.trayvon2017.plugindemo" for android
Installing "com.trayvon2017.plugindemo" for ios
Adding com.trayvon2017.plugindemo to package.json
after_plugin_add waited 1004 ms
Executing script found in plugin com.trayvon2017.plugindemo for hook "before_plugin_rm": plugins/com.trayvon2017.plugindemo/scripts/before_plugin_rm.js
before_plugin_rm waited 1003 ms
Calling plugman.uninstall on plugin "com.trayvon2017.plugindemo" for platform "android"
Finding scripts for "before_plugin_uninstall" hook from plugin com.trayvon2017.plugindemo on android platform only.
Executing script found in plugin com.trayvon2017.plugindemo for hook "before_plugin_uninstall": plugins/com.trayvon2017.plugindemo/scripts/before_plugin_uninstall.js
before_plugin_uninstall waited 1003 ms
Uninstalling com.trayvon2017.plugindemo from android
Loaded API for android project /Users/trayvon/code/cordova-projects/hello/platforms/android/cordova/Api.js
Beginning processing of action stack for android project...
Action stack processing complete.
Calling plugman.uninstall on plugin "com.trayvon2017.plugindemo" for platform "ios"
Finding scripts for "before_plugin_uninstall" hook from plugin com.trayvon2017.plugindemo on ios platform only.
No scripts found for hook "before_plugin_uninstall".
Uninstalling com.trayvon2017.plugindemo from ios
Loaded API for ios project /Users/trayvon/code/cordova-projects/hello/platforms/ios/cordova/Api.js
Beginning processing of action stack for ios project...
Action stack processing complete.
pods.json found in platforms/ios
Podfile found in platforms/ios
Removing "com.trayvon2017.plugindemo"
Deleted plugin "com.trayvon2017.plugindemo"
Running command: npm uninstall com.trayvon2017.plugindemo --save-dev
Command finished with error code 0: npm uninstall,com.trayvon2017.plugindemo,--save-dev
Removing com.trayvon2017.plugindemo from package.json
Removing plugin com.trayvon2017.plugindemo from fetch.json
No scripts found for hook "after_plugin_rm".
Bug Report
Problem
I want to do something after plugin is removed. I have tried to use
after_plugin_rm
hook in "plugin.xml" but it did not work.What is expected to happen?
Script for
after_plugin_rm
need to be executedWhat does actually happen?
No scripts found for hook
after_plugin_rm
.Information
Scripts for hooks(
after_plugin_add
、before_plugin_rm
andbefore_plugin_uninstall
) are all performed normally. After removing the plugin, the commandline outputs 'No scripts found for hook "after_plugin_rm"'I think It may be caused by the plugin code(include the script for "after_plugin_rm" hook) being removed before "after_plugin_rm" hook.
I built a simple cordova plugin repository for test.
Command or Code
Partial code in plugin.xml, full plugin code is here
add plugin
cordova plugin add https://github.com/trayvon2017/plugindemo.git
outputs:remove plugin
cordova plugin remove com.trayvon2017.plugindemo --verbose
outputs:Environment, Platform, Device
Version information
Cordova CLI: 11.0.0 and 12.0.0 Cordova Platforms: android Operating System: macos 13.5.2
Checklist