question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in Multi-app Project when build android app (Current working directory is not a Cordova-based project)

See original GitHub issue

Description:

I have an issue Current working directory is not a Cordova-based project with ionic multi-app project, when run ionic cordova build android. I was noticed that it creates www folder in the right place, but after Ionic hooks it disappears, even if I add this folder manually, right before ng commands. Maybe it’s somehow connected. It works fine with ng commands and ionic serve. I put output commands and my configs below.

Steps to Reproduce:

Just run ionic cordova build android in multi-app repo.

Output:

C:\Projects\apps>ionic cordova build android --verbose
  ionic:lib Terminal info: { tty: true, ci: false, windows: true } +0ms
  ionic:lib CLI global options: { _: [ 'cordova', 'build', 'android' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, project: null, '--': [] } +0ms  ionic:lib:project Project id from defaultProject: mobile-app +0ms
  ionic:lib:project Project type from config: @ionic/angular (angular) +0ms
  ionic:lib:project Project details: { configPath: 'C:\\Projects\\apps\\ionic.config.json', errors: [], context: 'multiapp', id: 'mobile-app', type: 'angular' } +0ms
  ionic Context: { binPath: 'C:\\Users\\efimov.e\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ionic', libPath: 'C:\\Users\\efimov.e\\AppData\\Roaming\\npm\\node_modules\\ionic', execPath: 'C:\\Projects\\apps', version: '4.8.0' } +0ms
√ Creating .\packages\mobile-app\www directory for you - done!
  ionic:lib:integrations:cordova:config Using config.xml: C:\Projects\apps\packages\mobile-app\config.xml +0ms
  ionic:lib:telemetry Sending telemetry for command: 'ionic cordova build' [ 'android', '--verbose', '--interactive', '--color' ] +0ms
  ionic:lib:hooks Looking for ionic:build:before npm script. +0ms
  ionic:lib:build Looking for ionic:build npm script. +0ms
> ng run mobile-app:ionic-cordova-build --platform=android --cordova-base-path=C:\Projects\apps\packages\mobile-app

Date: 2019-01-22T17:42:21.056Z
Hash: f2092757dbe3e9aab53d
Time: 31805ms
chunk {0} 0.js, 0.js.map () 16.6 kB  [rendered]
.......................
chunk {vendor} vendor.js, vendor.js.map9m (vendor) 6.06 MB [initial] [rendered]
  ionic:lib:hooks Looking for ionic:build:after npm script. +36s
> cordova build android --verbose
Current working directory is not a Cordova-based project.
CordovaError: Current working directory is not a Cordova-based project.
    at Object.cdProjectRoot (C:\Users\efimov.e\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\util.js:170:15)
    at C:\Users\efimov.e\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\build.js:27:39
    at _fulfilled (C:\Users\efimov.e\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:854:54)
    at self.promiseDispatch.done (C:\Users\efimov.e\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:883:30)
    at Promise.promise.promiseDispatch (C:\Users\efimov.e\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:816:13)
    at C:\Users\efimov.e\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:877:14
    at runSingle (C:\Users\efimov.e\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:137:13)
    at flush (C:\Users\efimov.e\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:132:7)
    at process._tickCallback (internal/process/next_tick.js:181:9)
[ERROR] An error occurred while running subprocess cordova.

        cordova build android --verbose exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.
  ionic:cli-framework:utils:process onBeforeExit handler: process.exit received +0ms
  ionic:cli-framework:utils:process onBeforeExit handler: running 2 functions +16ms
  ionic:cli-framework:utils:process error while killing process tree for 14480: { Error: Command failed: taskkill /pid 14480 /T /F
  ionic:cli-framework:utils:process ERROR: The process "14480" not found.
  ionic:cli-framework:utils:process
  ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:276:12)
  ionic:cli-framework:utils:process     at emitTwo (events.js:126:13)
  ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:214:7)
  ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:915:16)
  ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
  ionic:cli-framework:utils:process   killed: false,
  ionic:cli-framework:utils:process   code: 128,
  ionic:cli-framework:utils:process   signal: null,
  ionic:cli-framework:utils:process   cmd: 'taskkill /pid 14480 /T /F' } +86ms
  ionic:cli-framework:utils:process onBeforeExit handler: error from function: { Error: Command failed: taskkill /pid 14480 /T /F
  ionic:cli-framework:utils:process ERROR: The process "14480" not found.
  ionic:cli-framework:utils:process
  ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:276:12)
  ionic:cli-framework:utils:process     at emitTwo (events.js:126:13)
  ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:214:7)
  ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:915:16)
  ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
  ionic:cli-framework:utils:process   killed: false,
  ionic:cli-framework:utils:process   code: 128,
  ionic:cli-framework:utils:process   signal: null,
  ionic:cli-framework:utils:process   cmd: 'taskkill /pid 14480 /T /F' } +0ms
  ionic:cli-framework:utils:process error while killing process tree for 47836: { Error: Command failed: taskkill /pid 47836 /T /F
  ionic:cli-framework:utils:process ERROR: The process "47836" not found.
  ionic:cli-framework:utils:process
  ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:276:12)
  ionic:cli-framework:utils:process     at emitTwo (events.js:126:13)
  ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:214:7)
  ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:915:16)
  ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
  ionic:cli-framework:utils:process   killed: false,
  ionic:cli-framework:utils:process   code: 128,
  ionic:cli-framework:utils:process   signal: null,
  ionic:cli-framework:utils:process   cmd: 'taskkill /pid 47836 /T /F' } +0ms
  ionic:cli-framework:utils:process onBeforeExit handler: error from function: { Error: Command failed: taskkill /pid 47836 /T /F
  ionic:cli-framework:utils:process ERROR: The process "47836" not found.
  ionic:cli-framework:utils:process
  ionic:cli-framework:utils:process     at ChildProcess.exithandler (child_process.js:276:12)
  ionic:cli-framework:utils:process     at emitTwo (events.js:126:13)
  ionic:cli-framework:utils:process     at ChildProcess.emit (events.js:214:7)
  ionic:cli-framework:utils:process     at maybeClose (internal/child_process.js:915:16)
  ionic:cli-framework:utils:process     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
  ionic:cli-framework:utils:process   killed: false,
  ionic:cli-framework:utils:process   code: 128,
  ionic:cli-framework:utils:process   signal: null,
  ionic:cli-framework:utils:process   cmd: 'taskkill /pid 47836 /T /F' } +0ms
  ionic:cli-framework:utils:process onBeforeExit handler: exiting (exit code 1) +0ms

My ionic info:

Ionic:

   ionic (Ionic CLI)             : 4.8.0 (C:\Users\efimov.e\AppData\Roaming\npm\node_modules\ionic)
   Ionic Framework               : @ionic/angular 4.0.0-rc.2
   @angular-devkit/build-angular : 0.12.2 (C:\Projects\apps\node_modules\@angular-devkit\build-angular)
   @angular-devkit/schematics    : 7.2.1
   @angular/cli                  : 7.2.2 (C:\Projects\apps\node_modules\@angular\cli)
   @ionic/angular-toolkit        : 1.2.2

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : not available
   Cordova Plugins       : not available

System:

   NodeJS : v10.15.0 (C:\Program Files\nodejs\node.exe)
   npm    : 6.4.1
   OS     : Windows 10

Other Information:

Project structure:

root/
   ionic.config.json
   package.json // workspace package.json
   angular.json
   packages/
      mobile-app/
         config.xml
         package.json // project package.json

ionic.config.json

{
  "defaultProject": "mobile-app",
  "projects": {
    "mobile-app": {
      "name": "mobile-app",
      "integrations": {
        "cordova": {}
      },
      "type": "angular",
      "root": "packages/mobile-app"
    }
  }
}

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
imhoffdcommented, Jan 24, 2019

@evgeniyefimov I think that should be set automatically by our cordova-build builder. I will update and provide a fix. Thanks!

0reactions
evgeniyefimovcommented, Jan 24, 2019

As a temporary solution:

"architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "deleteOutputPath": false,
Read more comments on GitHub >

github_iconTop Results From Across the Web

Current working directory is not a Cordova-based project
A custom script that I use to deploy my app was accidentally moving the www directory out of the project root. This answer...
Read more >
Package build fails with error 'Current working directory is ...
Package builds will fail if cordova and the native platforms have not been properly initialized. The issue can be resolved by running the ......
Read more >
Current working directory is not a Cordova based project.
To fix this problem is pretty simple, make sure you navigate to the directory of your created project and re-execute the command again....
Read more >
Android Platform Guide - Apache Cordova
Android Platform Guide. This guide shows how to set up your SDK environment to deploy Cordova apps for Android devices, and how to...
Read more >
Shrink, obfuscate, and optimize your app
However, when you create a new project using Android Studio, shrinking, obfuscation, and code optimization is not enabled by default. That's because these ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found