Chuckytuh opened a new issue #679: Missing node_modules
URL: https://github.com/apache/cordova-android/issues/679
 
 
   # Bug Report
   
   ## Problem
   
   Using cordova-cli 7.1.0 to try and create a new cordova project with the 
android platform, using --nofetch, causes the platform add to fail.
   
   ### What is expected to happen?
   The expected behaviour is to successfully end up with a cordova project 
containing an android platform (8.0.0).
   
   ### What does actually happen?
   
   Shortly after running `cordova platform add android --nofetch` the execution 
ends with the following error:
   
   ```
   No scripts found for hook "before_platform_add".
   Removing "cordova-" prefix from cordova-android
   Adding android project...
   Unable to load PlatformApi from platform. Error: Cannot find module 'q'
   Error: Unhandled "error" event. (The platform "android" does not appear to 
be a valid cordova platform. It is missing API.js. android not supported.)
   ```
   
   ## Information
   <!-- Include all relevant information that might help understand and 
reproduce the problem -->
   
   When running `cordova platform add android --nofetch` the execution path 
goes into 
[addHelper.downloadPlatform()](https://github.com/apache/cordova-lib/blob/rel/7.1.0/src/cordova/platform/addHelper.js#L292)
 with `opts.fetch = false` which ends up "downloading" the platform using 
[lazy_load.cordova_npm()](https://github.com/apache/cordova-lib/blob/rel/7.1.0/src/cordova/lazy_load.js#L113).
 
   
   Later, while attempting to load android's `Api.js` file from the 
cordova-android module, it fails because it's dependencies aren't installed, 
namely `Q` module.
   
   This happens because cordova-android module is stored under npm_cache 
directory however, since `npm install` isn't executed, no dependencies aren't 
installed, hence the error.
   
   In conclusion, it seems that cordova-android 8.0.0 is missing the 
node_modules folder that existed on previous versions! 
   
   Updating cordova-cli is, sadly, not an option because cordova-fetch removed 
support for --nofetch and plugin installations are super slow.
   
   ### Command or Code
   <!-- What command or code is needed to reproduce the problem? -->
   
   ```bash
   $ cordova create AppName com.some.package AppName
   $ cd AppName && cordova platform add android --nofetch --verbose
   ```
   
   
   ### Environment, Platform, Device
   <!-- In what environment, on what platform or on which device are you 
experiencing the issue? -->
   Running on a macbook pro with OSX 10.14.
   
   ### 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.
   -->
   
   * Host: osx 10.14
   * cordova-cli: 7.1.4
   * cordova-android: 8.0.0
   * node: v8.11.3
   * npm: 6.1.0
   
   
   ## Checklist
   <!-- Please check the boxes by putting an x in the [ ] like so: [x] -->
   
   - [X] I searched for existing GitHub issues
   - [ ] I updated all Cordova tooling to most recent version
   - [X] I included all the necessary information above
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to