question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cordova requirements crash with "Cannot read property 'forEach' of undefined"

See original GitHub issue

Version used: 5.0.3 and 5.0.4

After running:

cordova requierements

it prints:

$ cordova requirements -d

Checking opts.platforms  :
PlatformApi successfully found for platform browser
PlatformApi successfully found for platform ios

Requirements check results for browser:
Cannot read property 'forEach' of undefined
TypeError: Cannot read property 'forEach' of undefined
    at /usr/local/lib/node_modules/cordova/src/cli.js:406:35
    at Array.map (<anonymous>)
    at /usr/local/lib/node_modules/cordova/src/cli.js:397:68
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:854:54)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:883:30
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:13)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:624:44
    at runSingle (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:137:13)
    at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:125:13)
    at process._tickCallback (internal/process/next_tick.js:61:11)

After adding some logs on cordova/clj.js I was able to see an undefined in the platformChecks from https://github.com/apache/cordova-cli/blob/master/src/cli.js#L375:

Debug-Values: browser undefined
Debug-Values: ios [object Object],[object Object],[object Object],[object Object]

Any idea if this is caused by this plugin or by my configuration?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
janpiocommented, Nov 23, 2018

(Which reminds me we should just make sure that a .gitignore is generated for new projects: https://github.com/apache/cordova-app-hello-world/issues/30)

1reaction
pashogcommented, Jan 15, 2020

@janpio tried from master and it prints:

Cannot read property 'version' of undefined
TypeError: Cannot read property 'version' of undefined
    at /usr/local/lib/node_modules/cordova/src/cli.js:391:83
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/cordova/src/cli.js:388:39
    at Array.map (<anonymous>)
    at /usr/local/lib/node_modules/cordova/src/cli.js:375:68
    at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:854:54)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:883:30
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:13)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:624:44
    at runSingle (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:137:13)

But it looks like master is behind 8.1.2 (older than npm repository one)

Have the same error with 9.0.0 (cordova-lib@9.0.1). In my case, an error appeared after removing all the platforms and adding an old android@5.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cordova requirements throwing 'foreach' undefined
It gives me no indication of where the error is stemming from, there is also no --debug property for requirements. As far as...
Read more >
cannot read properties of undefined (reading 'owncolumns')
Here's an example of a JavaScript TypeError: Cannot read property of undefined thrown when a property is attempted to be read on an...
Read more >
Typeerror: Cannot Read Property 'requestcontent' Of Undefined
Typeerror: Cannot Read Property 'requestcontent' Of UndefinedisArray method to only call the forEach method on a valid array. Solution 2: Check whether the ......
Read more >
Ionic android 12 splash error while adding cordova-android@11
here the error: Cannot read properties of null (reading 'find') TypeError: Cannot read properties of null (reading 'find') at E:\DEV\IONIC ...
Read more >
Typeerror: Cannot Read Property 'requestcontent' Of Undefined
Instead I get an error about trying to insert a null value into a required TypeError: Cannot read property 'requestContent' of undefined.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found