Skip to content

Cordova 10 error when adding or removing platform #543

@cumpstey

Description

@cumpstey

Bug Report

Problem

Updating an existing project from Cordova 9 to 10, I get an error when trying to add or remove a platform. Then tried with new Ionic project in clean Node installation, and get the same error.

What is expected to happen?

> cordova platform add android

The Android platform is added to the project.

> cordova platform remove android

The Android platform is removed from the project (or a message saying it's not part of the project).

What does actually happen?

ncumpstey@Apps-MBP test % cordova platform add android --verbose
No scripts found for hook "before_platform_add".
No version supplied. Retrieving version from config.xml...
Grabbing pinned version.
Using cordova-fetch for cordova-android@^9.0.0
fetch: Installing cordova-android@^9.0.0 to /Users/ncumpstey/Documents/Projects/test
Failed to fetch platform cordova-android@^9.0.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
CordovaError: TypeError: Cannot assign to read only property 'valueOf' of object '[object Object]'
CordovaError: Failed to fetch platform cordova-android@^9.0.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
CordovaError: TypeError: Cannot assign to read only property 'valueOf' of object '[object Object]'
    at /Users/ncumpstey/.nvm/versions/node/v12.20.0/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/platform/addHelper.js:288:31
ncumpstey@Apps-MBP test % cordova platform remove android --verbose
No scripts found for hook "before_platform_rm".
Removing platform android from platforms.json file...
TypeError: Cannot assign to read only property 'valueOf' of object '[object Object]'
    at Function.defer (/Users/ncumpstey/.nvm/versions/node/v12.20.0/lib/node_modules/cordova/node_modules/q/q.js:576:21)
    at Object.exports.spawn (/Users/ncumpstey/.nvm/versions/node/v12.20.0/lib/node_modules/cordova/node_modules/cordova-common/src/superspawn.js:64:17)
    at /Users/ncumpstey/.nvm/versions/node/v12.20.0/lib/node_modules/cordova/node_modules/cordova-fetch/index.js:177:31
CordovaError: TypeError: Cannot assign to read only property 'valueOf' of object '[object Object]'
    at /Users/ncumpstey/.nvm/versions/node/v12.20.0/lib/node_modules/cordova/node_modules/cordova-fetch/index.js:180:19

Information

Command or Code

> cordova platform add android
> cordova platform remove android

Environment, Platform, Device

Mac

Version information

MacOS 10.15.7
Node 12.20.0 and 10.15.3 - same behaviour in both.
Cordova CLI 10.0.0
Ionic CLI 6.12.2

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions