cordova-cli: CLI 8.0.1-dev (cordova-lib@9.0.0-dev) can't install local platforms (iOS, Android)

Currently fighting my way through https://github.com/apache/cordova-mobile-spec and using https://github.com/apache/cordova-coho to get everything locally - which means I am working with master of everything.

C:\Projects\throwaway\mobilespecAndroid  (helloworld@1.0.0)
λ cordova -v
8.0.1-dev (cordova-lib@9.0.0-dev)

Now I am having problems with installing the Android platform from a local folder (../cordova-android is the master checkout of cordova-android):

C:\Projects\throwaway\mobilespecAndroid  (helloworld@1.0.0)
λ cordova platform add ../cordova-android --verbose
Warning: using prerelease version 8.0.1-dev (cordova-lib@9.0.0-dev)
No scripts found for hook "before_platform_add".
fetch: Installing C:\Projects\throwaway\cordova-android to C:\Projects\throwaway\mobilespecAndroid
Running command: npm install C:\Projects\throwaway\cordova-android --production --save
Command finished with error code 0: npm install,C:\Projects\throwaway\cordova-android,--production,--save
Removing "cordova-" prefix from cordova-android
Warning: using prerelease platform android@8.0.0-dev.
Use 'cordova platform add android@latest' to add the latest published version instead.
Adding android project...
PlatformApi successfully found for platform android
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: io.cordova.hellocordova
        Name: HelloCordova
        Activity: MainActivity
        Android target: android-27
Copying android template project to platforms\android
Cannot find module 'cordova-common'
Error: Cannot find module 'cordova-common'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (C:\Projects\throwaway\mobilespecAndroid\platforms\android\cordova\lib\builders\builders.js:20:22)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)

The same works from GitHub directly:

C:\Projects\throwaway\mobilespecAndroid  (helloworld@1.0.0)                                                                                                                                                     
λ cordova platform add https://github.com/apache/cordova-android --verbose                                                                                                                                      
Warning: using prerelease version 8.0.1-dev (cordova-lib@9.0.0-dev)                                                                                                                                             
No scripts found for hook "before_platform_add".                                                                                                                                                                
Using cordova-fetch for https://github.com/apache/cordova-android                                                                                                                                               
fetch: Installing https://github.com/apache/cordova-android to C:\Projects\throwaway\mobilespecAndroid                                                                                                          
Running command: npm install https://github.com/apache/cordova-android --production --save                                                                                                                      
Command finished with error code 0: npm install,https://github.com/apache/cordova-android,--production,--save                                                                                                   
Removing "cordova-" prefix from cordova-android                                                                                                                                                                 
Warning: using prerelease platform android@8.0.0-dev.                                                                                                                                                           
Use 'cordova platform add android@latest' to add the latest published version instead.                                                                                                                          
Adding android project...                                                                                                                                                                                       
PlatformApi successfully found for platform android                                                                                                                                                             
Creating Cordova project for the Android platform:                                                                                                                                                              
        Path: platforms\android                                                                                                                                                                                 
        Package: io.cordova.hellocordova                                                                                                                                                                        
        Name: HelloCordova                                                                                                                                                                                      
        Activity: MainActivity                                                                                                                                                                                  
        Android target: android-27                                                                                                                                                                              
Copying android template project to platforms\android                                                                                                                                                           
Subproject Path: CordovaLib                                                                                                                                                                                     
Subproject Path: app                                                                                                                                                                                            
Android project created with cordova-android@8.0.0-dev                                                                                                                                                          
Checking for any plugins added to the project that have not been installed in android platform                                                                                                                  
No differences found between plugins added to project and installed in android platform. Continuing...                                                                                                          
PlatformApi successfully found for platform android                                                                                                                                                             
Generating platform-specific config.xml from defaults for android at C:\Projects\throwaway\mobilespecAndroid\platforms\android\app\src\main\res\xml\config.xml                                                  
Merging project's config.xml into platform-specific android config.xml                                                                                                                                          
[Gradle Properties] Preparing Configuration                                                                                                                                                                     
[Gradle Properties] File missing, creating file with Cordova defaults.                                                                                                                                          
[Gradle Properties] Appended missing default: org.gradle.daemon=true                                                                                                                                            
[Gradle Properties] Appended missing default: org.gradle.jvmargs=-Xmx2048m                                                                                                                                      
[Gradle Properties] Appended missing default: android.useDeprecatedNdk=true                                                                                                                                     
[Gradle Properties] Updating and Saving File                                                                                                                                                                    
Merging and updating files from [www, platforms\android\platform_www] to platforms\android\app\src\main\assets\www                                                                                              
  mkdir platforms\android\app\src\main\assets\www\cordova-js-src                                                                                                                                                
  mkdir platforms\android\app\src\main\assets\www\cordova-js-src\android                                                                                                                                        
  copy  platforms\android\platform_www\cordova-js-src\android\nativeapiprovider.js platforms\android\app\src\main\assets\www\cordova-js-src\android\nativeapiprovider.js (new file)                             
  copy  platforms\android\platform_www\cordova-js-src\android\promptbasednativeapi.js platforms\android\app\src\main\assets\www\cordova-js-src\android\promptbasednativeapi.js (new file)                       
  copy  platforms\android\platform_www\cordova-js-src\exec.js platforms\android\app\src\main\assets\www\cordova-js-src\exec.js (new file)                                                                       
  copy  platforms\android\platform_www\cordova-js-src\platform.js platforms\android\app\src\main\assets\www\cordova-js-src\platform.js (new file)                                                               
  mkdir platforms\android\app\src\main\assets\www\cordova-js-src\plugin                                                                                                                                         
  mkdir platforms\android\app\src\main\assets\www\cordova-js-src\plugin\android                                                                                                                                 
  copy  platforms\android\platform_www\cordova-js-src\plugin\android\app.js platforms\android\app\src\main\assets\www\cordova-js-src\plugin\android\app.js (new file)                                           
  copy  platforms\android\platform_www\cordova.js platforms\android\app\src\main\assets\www\cordova.js (updated file)                                                                                           
  delete platforms\android\app\src\main\assets\www\img\cordova.png (no source)                                                                                                                                  
  copy  www\index.html platforms\android\app\src\main\assets\www\index.html (updated file)                                                                                                                      
  copy  www\js\index.js platforms\android\app\src\main\assets\www\js\index.js (updated file)                                                                                                                    
Wrote out android application name "HelloCordova" to C:\Projects\throwaway\mobilespecAndroid\platforms\android\app\src\main\res\values\strings.xml                                                              
android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.0.0): 10000                                                                                                    
Wrote out Android package name "io.cordova.hellocordova" to C:\Projects\throwaway\mobilespecAndroid\platforms\android\app\src\main\java\io\cordova\hellocordova\MainActivity.java                               
This app does not have launcher icons defined                                                                                                                                                                   
This app does not have splash screens defined                                                                                                                                                                   
This app does not have additional resource files defined                                                                                                                                                        
Prepared android project successfully                                                                                                                                                                           
No scripts found for hook "before_prepare".                                                                                                                                                                     
Checking config.xml and package.json for saved platforms that haven't been added to the project                                                                                                                 
Checking config.xml for saved plugins that haven't been added to the project                                                                                                                                    
Discovered plugin "cordova-plugin-whitelist" in config.xml. Adding it to the project                                                                                                                            
No scripts found for hook "before_plugin_add".                                                                                                                                                                  
Calling plugman.fetch on plugin "cordova-plugin-whitelist@1"                                                                                                                                                    
fetch: Installing cordova-plugin-whitelist@"1" to C:\Projects\throwaway\mobilespecAndroid                                                                                                                       
Running command: npm install cordova-plugin-whitelist@"1" --save                                                                                                                                                
Command finished with error code 1: npm install,cordova-plugin-whitelist@"1",--save                                                                                                                             
Failed to restore plugin "cordova-plugin-whitelist" from config.xml. You might need to try adding it again. Error: Failed to fetch plugin cordova-plugin-whitelist@1 via registry.                              
Probably this is either a connection problem, or plugin spec is incorrect.                                                                                                                                      
Check your connection and plugin name/version/URL.                                                                                                                                                              
Error: npm: Command failed with exit code 1 Error output:                                                                                                                                                       
npm ERR! code EINVALIDTAGNAME                                                                                                                                                                                   
npm ERR! Invalid tag name ""1"": Tags may not have any characters that encodeURIComponent encodes.                                                                                                              
                                                                                                                                                                                                                
npm ERR! A complete log of this run can be found in:                                                                                                                                                            
npm ERR!     C:\Users\Jan\AppData\Roaming\npm-cache\_logs\2018-11-24T00_58_41_165Z-debug.log                                                                                                                    
Checking for any plugins added to the project that have not been installed in android platform                                                                                                                  
No differences found between plugins added to project and installed in android platform. Continuing...                                                                                                          
Generating platform-specific config.xml from defaults for android at C:\Projects\throwaway\mobilespecAndroid\platforms\android\app\src\main\res\xml\config.xml                                                  
Merging project's config.xml into platform-specific android config.xml                                                                                                                                          
[Gradle Properties] Preparing Configuration                                                                                                                                                                     
[Gradle Properties] Updating and Saving File                                                                                                                                                                    
Merging and updating files from [www, platforms\android\platform_www] to platforms\android\app\src\main\assets\www                                                                                              
  copy  platforms\android\platform_www\cordova-js-src\android\nativeapiprovider.js platforms\android\app\src\main\assets\www\cordova-js-src\android\nativeapiprovider.js (updated file)                         
  copy  platforms\android\platform_www\cordova-js-src\android\promptbasednativeapi.js platforms\android\app\src\main\assets\www\cordova-js-src\android\promptbasednativeapi.js (updated file)                   
  copy  platforms\android\platform_www\cordova-js-src\exec.js platforms\android\app\src\main\assets\www\cordova-js-src\exec.js (updated file)                                                                   
  copy  platforms\android\platform_www\cordova-js-src\platform.js platforms\android\app\src\main\assets\www\cordova-js-src\platform.js (updated file)                                                           
  copy  platforms\android\platform_www\cordova-js-src\plugin\android\app.js platforms\android\app\src\main\assets\www\cordova-js-src\plugin\android\app.js (updated file)                                       
  copy  platforms\android\platform_www\cordova.js platforms\android\app\src\main\assets\www\cordova.js (updated file)                                                                                           
  copy  www\index.html platforms\android\app\src\main\assets\www\index.html (updated file)                                                                                                                      
  copy  www\js\index.js platforms\android\app\src\main\assets\www\js\index.js (updated file)                                                                                                                    
Wrote out android application name "HelloCordova" to C:\Projects\throwaway\mobilespecAndroid\platforms\android\app\src\main\res\values\strings.xml                                                              
android-versionCode not found in config.xml. Generating a code based on version in config.xml (1.0.0): 10000                                                                                                    
Wrote out Android package name "io.cordova.hellocordova" to C:\Projects\throwaway\mobilespecAndroid\platforms\android\app\src\main\java\io\cordova\hellocordova\MainActivity.java                               
This app does not have launcher icons defined                                                                                                                                                                   
This app does not have splash screens defined                                                                                                                                                                   
This app does not have additional resource files defined                                                                                                                                                        
Prepared android project successfully                                                                                                                                                                           
No scripts found for hook "after_prepare".                                                                                                                                                                      
Saving android@https://github.com/apache/cordova-android into platforms.json                                                                                                                                    
--save flag or autosave detected                                                                                                                                                                                
Saving android@https://github.com/apache/cordova-android into config.xml file ...                                                                                                                               
adding android to cordova.platforms array in package.json                                                                                                                                                       
No scripts found for hook "after_platform_add".                                                                                                                                                                                                                                                                                                                                                                              

So somehow installing from a local folder is broken.

My npm:

λ npm -v
6.4.1

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (12 by maintainers)

Most upvoted comments

@janpio Regarding the node_modules folder, see https://github.com/apache/cordova/issues/32