Skip to content

cordova version 10.0.0 error on every command #522

@SamiElkateb

Description

@SamiElkateb

Bug Report

On updating the cordova to 10.0.0 version, cordova commands are failing with the below error

Problem

When I try using any cordova command (cordova create hello com.example.hello HelloWorld, cordova platform add ios, cordova build ios) I get the error message:
/usr/local/lib/node_modules/cordova/node_modules/update-notifier/index.js:103
async fetchInfo() {

What is expected to happen?

Project creating, adding ios or build ios

Full Error messsage

/usr/local/lib/node_modules/cordova/node_modules/update-notifier/index.js:103
	async fetchInfo() {
	      ^^^^^^^^^
SyntaxError: Unexpected identifier
    at Object.exports.runInThisContext (vm.js:78:16)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/usr/local/lib/node_modules/cordova/src/cli.js:19:22)
    at Module._compile (module.js:571:32)

Function causing the problem

async fetchInfo() {
		const {distTag} = this.options;
		const latest = await latestVersion()(this.packageName, {version: distTag});

		return {
			latest,
			current: this.packageVersion,
			type: semverDiff()(this.packageVersion, latest) || distTag,
			name: this.packageName
		};
	}

Information

The error doesn't occur on cordova version 9.0.0
After trying to debug by changing the asynchronous function to synchronous, I get a new error message:

/usr/local/lib/node_modules/cordova/node_modules/cordova-common/src/ConfigParser/ConfigParser.js:191
            ...attrib
            ^^^
SyntaxError: Unexpected token ...
    at Object.exports.runInThisContext (vm.js:78:16)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at Object.get ConfigParser [as ConfigParser] (/usr/local/lib/node_modules/cordova/node_modules/cordova-common/cordova-common.js:29:34)
    at Object.<anonymous> (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/cordova-lib.js:30:25)

Command or Code

Any cordova command produces the problem
cordova create hello com.example.hello HelloWorld
cordova platform add ios
cordova platform build ios

Environment, Platform, Device

macOS Catalina Version 10.15.4

Version information

Cordova 10.0.0

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