Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
evgeniyefimov opened this issue Jan 22, 2019 · 6 comments
Labels

Comments

@evgeniyefimov
Copy link

evgeniyefimov commented Jan 22, 2019

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 ([email protected])
   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"
    }
  }
}
@ionitron-bot ionitron-bot bot added the triage label Jan 22, 2019
@imhoffd
Copy link
Contributor

imhoffd commented Jan 22, 2019

@evgeniyefimov Can I also see your angular.json configuration for mobile-app:ionic-cordova-build?

You may be running into the same issue as ionic-team/angular-toolkit#51

@evgeniyefimov
Copy link
Author

evgeniyefimov commented Jan 23, 2019

@dwieeb sure, here is:

{
  "$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json",
  "version": 1,
  "defaultProject": "mobile-app",
  "newProjectRoot": "packages",
  "projects": {
    "mobile-app": {
      "root": "packages/mobile-app/",
      "sourceRoot": "packages/mobile-app/src",
      "projectType": "application",
      "prefix": "tt",
      "schematics": {},
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "packages/mobile-app/www",
            "index": "packages/mobile-app/src/index.html",
            "main": "packages/mobile-app/src/main.ts",
            "polyfills": "packages/mobile-app/src/polyfills.ts",
            "tsConfig": "packages/mobile-app/src/tsconfig.app.json",
            "assets": [
              {
                "glob": "**/*",
                "input": "packages/mobile-app/assets",
                "output": "assets"
              },
              {
                "glob": "**/*",
                "input": "assets",
                "output": "assets"
              },
              {
                "glob": "**/*.svg",
                "input": "packages/mobile-app/node_modules/ionicons/dist/ionicons/svg",
                "output": "./svg"
              }
            ],
            "styles": ["packages/mobile-app/theme/app.scss"],
            "scripts": []
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "packages/config/local.config.ts",
                  "with": "packages/config/local.config.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "extractCss": true,
              "namedChunks": false,
              "aot": true,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                }
              ]
            },
            "ci": {
              "progress": false
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "mobile-app:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "mobile-app:build:production"
            },
            "ci": {
              "progress": false
            }
          }
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "mobile-app:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "main": "packages/mobile-app/src/test.ts",
            "polyfills": "packages/mobile-app/src/polyfills.ts",
            "tsConfig": "packages/mobile-app/src/tsconfig.spec.json",
            "karmaConfig": "packages/mobile-app/src/karma.conf.js",
            "styles": [],
            "scripts": [],
            "assets": [
              {
                "glob": "favicon.ico",
                "input": "src/",
                "output": "/"
              },
              {
                "glob": "**/*",
                "input": "assets",
                "output": "/assets"
              }
            ]
          },
          "configurations": {
            "ci": {
              "progress": false,
              "watch": false
            }
          }
        },
        "lint": {
          "builder": "@angular-devkit/build-angular:tslint",
          "options": {
            "tsConfig": ["packages/mobile-app/src/tsconfig.app.json", "packages/mobile-app/src/tsconfig.spec.json"],
            "exclude": ["**/node_modules/**"]
          }
        },
        "ionic-cordova-build": {
          "builder": "@ionic/angular-toolkit:cordova-build",
          "options": {
            "browserTarget": "mobile-app:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "mobile-app:build:production"
            }
          }
        },
        "ionic-cordova-serve": {
          "builder": "@ionic/angular-toolkit:cordova-serve",
          "options": {
            "cordovaBuildTarget": "mobile-app:ionic-cordova-build",
            "devServerTarget": "mobile-app:serve"
          },
          "configurations": {
            "production": {
              "cordovaBuildTarget": "mobile-app:ionic-cordova-build:production",
              "devServerTarget": "mobile-app:serve:production"
            }
          }
        }
      }
    }
  },
  "cli": {
    "defaultCollection": "@ionic/angular-toolkit"
  },
  "schematics": {
    "@ionic/angular-toolkit:component": {
      "styleext": "scss"
    },
    "@ionic/angular-toolkit:page": {
      "styleext": "scss"
    }
  }
}

@imhoffd
Copy link
Contributor

imhoffd commented Jan 23, 2019

@evgeniyefimov Thank you. And this doesn't happen for regular single-app projects?

@evgeniyefimov
Copy link
Author

@dwieeb Regular single-app project works fine.

@evgeniyefimov
Copy link
Author

As a temporary solution:

"architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "deleteOutputPath": false,

@imhoffd
Copy link
Contributor

imhoffd commented Jan 24, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants