I have a local cordova plugin, which cannot be parsed during build. It works fine on local env, but for some reason plugins with “file:…” doesn’t recognized.
LOGS:
+------------------------------------------------------------------------------+
| (3) Script |
+------------------------------------------------------------------------------+
| id: script |
| version: 1.2.1 |
| collection: https://github.com/bitrise-io/bitrise-steplib.git |
| toolkit: bash |
| time: 2024-01-18T15:16:24Z |
+------------------------------------------------------------------------------+
| |
+ git submodule update --init --remote
Warning: Permanently added 'bitbucket.org' (ED25519) to the list of known hosts.
+ npm install -g cordova-res
added 62 packages, and audited 63 packages in 4s
10 packages are looking for funding
run `npm fund` for details
1 high severity vulnerability
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
Reshimming asdf nodejs...
+ sed -i -e s/0.0.1//g config.xml
+ npm -v
8.19.2
+ npm run prepare_build prod true
> xxxx@0.0.1 prepare_build
> node scripts/prepare_build.js prod true
Preparing build for customer: environment=prod, bundleId=com.xxx, appName=xxxxx
++ node scripts/check_bundle_id.js prod false
+ bundleIdChanged='==Doing check bundleId prod
true'
++ grep ' id="' config.xml
++ sed 's/.* id="//'
++ sed 's/".*//'
+ bundleId=com.xxx
+ echo com.xxx
com.xxx
+ npx ionic info
Ionic:
Ionic CLI : 6.20.9
Ionic Framework : @ionic/angular 6.7.5
@angular-devkit/build-angular : 15.2.10
@angular-devkit/schematics : 15.2.10
@angular/cli : 15.2.10
@ionic/angular-toolkit : 8.1.0
Cordova:
Cordova CLI : 12.0.0 (cordova-lib@12.0.1)
Cordova Platforms : not available
Cordova Plugins : not available
Utility:
cordova-res : 0.15.4
native-run : not installed globally
System:
Android SDK Tools : 26.1.1 (/usr/local/share/android-sdk)
ios-sim : 8.0.2
NodeJS : v18.18.2 (/Users/vagrant/.asdf/installs/nodejs/18.18.2/bin/node)
npm : 2.15.12
OS : macOS Unknown
Xcode : Xcode 14.3.1 Build version 14E300c
+ npx -v
8.19.2
+ cd local_plugins
+ ls
cordova-phonegap-plugin-barcodescanner
cordova-plugin-firebase
cordova-plugin-document-scanner
cordova-plugin-fidel
cordova-plugin-geofence
cordova-plugin-googlemaps
cordova-plugin-googlemaps-sdk
cordova-plugin-googleplus
phonegap-nfc
+ npm -v
8.19.2
+ npx ionic cordova build android -c=production --release
✔ Creating ../www directory for you in 253.04μs
> cordova platform add android --save
Using cordova-fetch for cordova-android@^11.0.0
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.xxx
Name: xxxx
Activity: MainActivity
Android Target SDK: android-33
Android Compile SDK: 33
Subproject Path: CordovaLib
Subproject Path: app
Android project created with cordova-android@11.0.0
config file *-Info.plist requested for changes not found at /Users/vagrant/git/platforms/android/*-Info.plist, ignoring
Discovered plugin "cordova-plugin-whitelist". Adding it to the project
Installing "cordova-plugin-whitelist" for android
Plugin doesn't support this project's cordova-android version. cordova-android: 11.0.0, failed version requirement: >=4.0.0 <10.0.0
Skipping 'cordova-plugin-whitelist' for android
Adding cordova-plugin-whitelist to package.json
config file *-Info.plist requested for changes not found at /Users/vagrant/git/platforms/android/*-Info.plist, ignoring
Discovered plugin "cordova-plugin-device". Adding it to the project
Installing "cordova-plugin-device" for android
Adding cordova-plugin-device to package.json
Discovered plugin "cordova-plugin-ionic-webview". Adding it to the project
Installing "cordova-plugin-ionic-webview" for android
Subproject Path: CordovaLib
Subproject Path: app
Adding cordova-plugin-ionic-webview to package.json
Discovered plugin "cordova-plugin-ionic-keyboard". Adding it to the project
Installing "cordova-plugin-ionic-keyboard" for android
Adding cordova-plugin-ionic-keyboard to package.json
Discovered plugin "cordova-plugin-advanced-http". Adding it to the project
Installing "cordova-plugin-advanced-http" for android
Installing "cordova-plugin-file" for android
The Android Persistent storage location now defaults to "Internal". Please check this plugin's README to see if your application needs any changes in its config.xml.
If this is a new application no changes are required.
If this is an update to an existing application that did not specify an "AndroidPersistentFileLocation" you may need to add:
"<preference name="AndroidPersistentFileLocation" value="Compatibility" />"
to config.xml in order for the application to find previously stored files.
Adding cordova-plugin-advanced-http to package.json
Discovered plugin "phonegap-nfc". Adding it to the project
Failed to restore plugin "phonegap-nfc". You might need to try adding it again. Error: CordovaError: Failed to fetch plugin file:local_plugins/phonegap-nfc via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
CordovaError: Error: Command failed with exit code 1: npm install file:local_plugins/phonegap-nfc --save-dev
npm ERR! Darwin 22.6.0
npm ERR! argv "/Users/vagrant/.asdf/installs/nodejs/18.18.2/bin/node" "/Users/vagrant/git/node_modules/.bin/npm" "install" "file:local_plugins/phonegap-nfc" "--save-dev"
npm ERR! node v18.18.2
npm ERR! npm v2.15.12
npm ERR! file /Users/vagrant/git/node_modules/phonegap-nfc/package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected token 'c' at 1:1
npm ERR! cord = [\r\n ndef.textRecord(\"hello, world\")\r\n ];\r\n\r\n
npm ERR! ^
npm ERR! File: /Users/vagrant/git/node_modules/phonegap-nfc/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! Please include the following file with any support request:
npm ERR! /Users/vagrant/git/npm-debug.log
Discovered plugin "cordova-plugin-androidx-adapter". Adding it to the project
Installing "cordova-plugin-androidx-adapter" for android
Adding cordova-plugin-androidx-adapter to package.json
Discovered plugin "cordova-plugin-add-swift-support". Adding it to the project
part of my package.json
"cordova-plugin-firebasex": "file:local_plugins/cordova-plugin-firebase",
"cordova-android": "^11.0.0",
"cordova-ios": "^6.1.1",
"cordova-plugin-app-version": "^0.1.12",
"cordova-plugin-buildinfo": "^4.0.0",
"cordova-plugin-camera": "github:ochakov/cordova-plugin-camera#e6e49b85b59263fc5782e835160d01a8932e3690",
"cordova-plugin-customurlscheme": "^5.0.2",
"cordova-plugin-facebook-connect": "^3.2.0",
"cordova-plugin-fidel": "file:local_plugins/cordova-plugin-fidel",
"cordova-plugin-firebase-analytics": "^7.0.5",
"cordova-plugin-firebase-dynamiclinks": "github:askona/cordova-plugin-firebase-dynamiclinks",
"cordova-plugin-geofence": "file:local_plugins/cordova-plugin-geofence",
"cordova-plugin-googleplus": "file:local_plugins/cordova-plugin-googleplus",
"cordova-plugin-inappbrowser": "^5.0.0",
"cordova-plugin-splashscreen": "github:apache/cordova-plugin-splashscreen",
"cordova-sqlite-storage": "^6.0.0",
"cordova-support-android-plugin": "~2.0.4",
"cordova.plugins.diagnostic": "^7.1.3",
"cross-env": "^7.0.3",
"es6-promise-plugin": "^4.2.2",
"eslint": "^8.33.0",
"jasmine-core": "^4.6.0",
"jasmine-spec-reporter": "~7.0.0",
"karma": "^6.4.1",
"karma-chrome-launcher": "~3.1.1",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-jasmine": "^5.1.0",
"karma-jasmine-html-reporter": "^2.0.0",
"ngx-json-viewer": "^3.2.1",
"phonegap-nfc": "file:local_plugins/phonegap-nfc",
"phonegap-plugin-barcodescanner": "file:local_plugins/cordova-phonegap-plugin-barcodescanner",
"protractor": "~7.0.0",
"shelljs": "^0.8.5",
"ts-node": "~10.9.1",
"typescript": "~4.9.5"
bitrise.yml::
---
format_version: '13'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: ionic
workflows:
deploy:
steps:
- activate-ssh-key@4: {}
- git-clone@8: {}
- npm@1:
inputs:
- npm_version: 8.19.2
- command: install
title: npm install
- script@1:
inputs:
- content: "#!/usr/bin/env bash\n# fail if any commands fails\nset -e\n# make
pipelines' return status equal the last command to exit with a non-zero
status, or zero if all commands exit successfully\nset -o pipefail\n#
debug log\nset -x\n\n
##############################################################################ngit
submodule update --init --remote
npm install -g cordova-res
sed -i -e \"s/0.0.1/$build_version/g\" config.xml
npm -v
npm run prepare_build
$build_customer $build_env true
#node scripts/before_platform_build.js $build_customer
npx ionic info
npx -v
ls
cd local_plugins
ls
npm -v
ionic cordova build android -c=production -release
##################################################################################
- certificate-and-profile-installer@1: {}
- ionic-archive@2.1:
inputs:
- run_ionic_prepare: 'false'
- cordova_version: '11'
- platform: "$IONIC_PLATFORM"
- deploy-to-itunesconnect-deliver@2: {}
- deploy-to-bitrise-io@2: {}
- generate-cordova-build-configuration@0: {}
- slack@4:
inputs:
- text: test msg
- emoji: ":ghost:"
- channel: "@A
envs:
- opts:
is_expand: false
build_customer: xxx
- opts:
is_expand: false
build_env: prod
primary:
steps:
- activate-ssh-key@4: {}
- git-clone@8: {}
- restore-npm-cache@1: {}
- npm@1:
inputs:
- command: install
- karma-jasmine-runner@0: {}
- save-npm-cache@1: {}
- deploy-to-bitrise-io@2: {}
meta:
bitrise.io:
stack: osx-xcode-14.3.x-ventura
machine_type_id: g2-m1.4core
app:
envs:
- opts:
is_expand: false
IONIC_PLATFORM: ios,android
trigger_map:
- push_branch: master
workflow: primary
- pull_request_source_branch: "*"
workflow: primary