GitToTheHub opened a new issue, #219:
URL: https://github.com/apache/cordova-common/issues/219

   # Bug Report
   I'm new in plugin development and tried to write a hook. I used as an example
   
https://github.com/AyogoHealth/cordova-plugin-app-scope/blob/main/src/prepare_hook.js
   
   When I was executing the line: `const et = require('elementtree');` I got an 
error on the console:
   
   ```bash
   TypeError [ERR_INVALID_ARG_TYPE]: The "code" argument must be of type 
number. Received type string ('MODULE_NOT_FOUND')
       at process.set [as exitCode] (node:internal/bootstrap/node:123:9)
       at 
/Users/manuelbeck/.nvm/versions/node/v22.9.0/lib/node_modules/cordova/bin/cordova:32:22
   ```
   
   I was wondering about this error message and looked in `cordova:32:22`. The 
line which was throwing the error was:
   `process.exitCode = err.code || 1;`
   
   I understood, the console was complaining that `code` was a string instead 
of a number. When I did `console.log(err)` in the script, I saw the error 
message:
   
   ```bash
   Error: Cannot find module 'elementtree'
   Require stack:
   - 
/Users/manuelbeck/Projekte/GitHub/cordova-plugin-local-notifications/src/prepare_hook.js
   - 
/Users/manuelbeck/.nvm/versions/node/v22.9.0/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js
   - 
/Users/manuelbeck/.nvm/versions/node/v22.9.0/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/install.js
   - 
/Users/manuelbeck/.nvm/versions/node/v22.9.0/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/plugman.js
   - 
/Users/manuelbeck/.nvm/versions/node/v22.9.0/lib/node_modules/cordova/node_modules/cordova-lib/cordova-lib.js
   ...
   ```
   
   This should be fixed.
   
   ### Command or Code
   `cordova prepare android`
   
   
   ### Environment, Platform, Device
   macOS 15.2
   MacBook Pro 2019 13"
   ZSH
   
   ### Version information
   <!--
   What are relevant versions you are using?
   For example:
   Cordova: Cordova CLI, Cordova Platforms, Cordova Plugins
   Other Frameworks: Ionic Framework and CLI version
   Operating System, Android Studio, Xcode etc.
   -->
   Cordova CLI: 12.0.0 (cordova-lib@12.0.2)
   cordova-Android: 13.0.0


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to