keni
keni

Reputation: 59

The "path" argument must be of type string. Received type undefined - Ionic 4 - Windows only

I've come across an error that I have no idea how it's come about, but it is blocking me to develop on a PC... I can build my app on a Mac, but when I try on a Windows box it fails with.

cordova build android --stacktrace

config file undefined requested for changes not found at platforms\android\undefined, ignoring config file undefined requested for changes not found at platforms\android\undefined, ignoring

The "path" argument must be of type string. Received type undefined

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined

at validateString (internal/validators.js:112:11)

That's even on a clean Windows machine cloned from GIT.

$ ionic info

Ionic:

Ionic CLI : 5.4.13 (\AppData\Roaming\npm\node_modules\ionic) Ionic Framework : @ionic/angular 4.11.7 @angular-devkit/build-angular : 0.803.21 @angular-devkit/schematics : 8.1.3 @angular/cli : 8.3.20 @ionic/angular-toolkit : 2.0.0

Cordova:

Cordova CLI : 9.0.0 ([email protected]) Cordova Platforms : android 8.1.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.3, (and 12 other plugins)

Utility:

cordova-res : 0.8.1 native-run : 0.3.0

System:

NodeJS : v12.14.0 (C:\Program Files\nodejs\node.exe) npm : 6.13.4 OS : Windows 10


{
  "name": "xyz1",
  "version": "0.0.7",
  "author": "Keni Barwick",
  "homepage": "https://barwick.net/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "~8.1.2",
    "@angular/compiler": "~8.1.2",
    "@angular/core": "~8.1.2",
    "@angular/fire": "^5.2.1",
    "@angular/forms": "~8.1.2",
    "@angular/http": "^7.2.15",
    "@angular/platform-browser": "~8.1.2",
    "@angular/platform-browser-dynamic": "~8.1.2",
    "@angular/router": "~8.1.2",
    "@ionic-native/app-version": "^5.18.0",
    "@ionic-native/core": "^5.18.0",
    "@ionic-native/google-analytics": "^5.18.0",
    "@ionic-native/health": "^5.18.0",
    "@ionic-native/image-picker": "^5.18.0",
    "@ionic-native/ionic-webview": "^5.18.0",
    "@ionic-native/onesignal": "^5.18.0",
    "@ionic-native/splash-screen": "^5.18.0",
    "@ionic-native/status-bar": "^5.18.0",
    "@ionic/angular": "^4.11.7",
    "cordova-android": "^8.1.0",
    "cordova-plugin-androidx": "^1.0.2",
    "cordova-plugin-androidx-adapter": "^1.1.0",
    "cordova-plugin-app-version": "^0.1.9",
    "cordova-plugin-exitapp2": "^1.0.4",
    "cordova-plugin-firebasex": "^7.0.1",
    "cordova-plugin-google-analytics": "1.6.0",
    "cordova-plugin-health": "^1.1.3",
    "cordova-plugin-telerik-imagepicker": "^2.3.3",
    "cordova-res": "^0.8.1",
    "core-js": "^2.6.11",
    "firebase": "^6.5.0",
    "html-webpack-plugin": "^3.2.0",
    "kr.co.joycorp.cordova.exitapp": "^1.0.2",
    "ngx-pipes": "^2.6.0",
    "npm": "^6.13.4",
    "onesignal-cordova-plugin": "^2.8.1",
    "rxjs": "^6.5.4",
    "tslib": "^1.9.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/architect": "~0.801.2",
    "@angular-devkit/build-angular": "^0.803.21",
    "@angular-devkit/core": "~8.1.2",
    "@angular-devkit/schematics": "~8.1.2",
    "@angular/cli": "8.3.20",
    "@angular/compiler": "~8.1.2",
    "@angular/compiler-cli": "~8.1.2",
    "@angular/language-service": "~8.1.2",
    "@ionic/angular-toolkit": "~2.0.0",
    "@ionic/lab": "2.0.10",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.2.1",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^4.1.1",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.5.1",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.4.3"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-telerik-imagepicker": {},
      "cordova-plugin-health": {
        "HEALTH_READ_PERMISSION": "App needs read access",
        "HEALTH_WRITE_PERMISSION": "App needs write access",
        "GMS_VERSION": "16.0.1"
      },
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-ionic-keyboard": {},
      "kr.co.joycorp.cordova.exitapp": {},
      "cordova-plugin-app-version": {},
      "cordova-plugin-google-analytics": {},
      "cordova-plugin-firebasex": {},
      "cordova-plugin-androidx-adapter": {},
      "onesignal-cordova-plugin": {}
    },
    "platforms": [
      "android"
    ],
    "browserslist": []
  }
}

I've updated all plugin's that show as red in npm outdated, checked lots of Stacks for answers but to no avail...

Upvotes: 3

Views: 8660

Answers (2)

Cesar
Cesar

Reputation: 595

In my case, changing:

<config-file

to

<gap:config-file

resolved the issue.

EDIT: Got another app, another case. I had to add "target" attribute to config-file. Example:

<config-file target="AndroidManifest.xml" parent="/manifest">

Also, if you got a project prepared for PhoneGapBuild and now you need to compile it yourself, remember to set your config under "platform" to diferentiate platform settings. Example:

<plaform name="android">
    <config-file target="AndroidManifest.xml" parent="/manifest">

Upvotes: 0

keni
keni

Reputation: 59

I knew as soon as I created a post I'd find the answer lol

So it turns out the issue was in the config.xml and specifically the following;

<config-file parent="NSHealthShareUsageDescription" platform="ios">
    <string>App needs read access</string>
</config-file>
<config-file parent="NSHealthUpdateUsageDescription" platform="ios">
    <string>App needs write access</string>
</config-file>

I removed the above, I was attempting to understand why I was gaining the following warning;

config file undefined requested for changes not found at platforms\android\undefined, ignoring

Once I removed it I was able to get passed the Path error... Odd right?

Upvotes: 2

Related Questions