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.

Cannot find module 'cordova-lib'

See original GitHub issue

Describe the bug Hi Dave,

I followed one of your last post (https://github.com/arnesson/cordova-plugin-firebase/issues/1081#issuecomment-503135862) to solve my issue regarding Android, which worked like charm.

Now I’m trying to build my iOS platform but I’m facing the following error.

(in a frech new platform):

ionic cordova plugin add https://github.com/dpa99c/cordova-plugin-firebase.git --save

which result in:

- /usr/local/lib/node_modules/cordova/bin/cordova
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:623:15)
    at Function.Module._load (internal/modules/cjs/loader.js:527:27)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.getAppName (/Users/myProject/plugins/cordova-plugin-firebase/scripts/lib/utilities.js:27:24)
    at Object.getXcodeProjectPath (/Users/myProject/plugins/cordova-plugin-firebase/scripts/ios/helper.js:22:29)
    at module.exports (/Users/myProject/plugins/cordova-plugin-firebase/scripts/ios/after_plugin_install.js:7:35)
    at runScriptViaModuleLoader (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:181:32)
    at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:157:16)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:125:20
Cannot find module 'cordova-lib'

I double checked, Cordova is in /usr/local and inside the lib I’ve got Cordova-lib in its node_modules

Honestly not sure if it’s a bug or a support request, I hope you don’t mind too much opening an issue. I just ask my self if the issue would not be NodeJs v12 or Cordova v9 related maybe?

Best regards and thx in advance for any hints. If it’s too obvious of course close the issue without comment, I would not mind.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
dpa99ccommented, Jun 19, 2019

I’ve been fiddling with this plugin today to try to fix it to work with cordova@9 which means replacing the requireCordovaModule() calls in the hook scripts with straight up require().

Since cordova-lib is a dependency of cordova it should be installed globally and therefore available without explicitly pinning it as a dependency of the plugin (I didn’t want to do this in case it caused a version conflict with the globally installed version of cordova).

That seems to have worked OK in my production projects, but that might be because something else has pulling in cordova-lib locally. So I’ll re-run my test case with this plugin in isolation to see if I can repro your error. If so, I guess I’ll need to add an explicit dependency on cordova-lib to this fork.

2reactions
dpa99ccommented, Jun 19, 2019

@dpa99c thx! the Android platform works for me too. I face problems with the iOS one

Doh! Wrong platform! 😬 Will try iOS…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot find module 'C:[...]\platforms\android\cordova\lib ...
Found the solution: Create file \platforms\android\cordova\lib\AndroidStudio.js /* * This is a simple routine that checks if project is an ...
Read more >
iOS platform upgrade fails - Google Groups
Error: Cannot find module 'shelljs'. at Function.Module. ... <anonymous> (/Users/home/.cordova/lib/npm_cache/cordova-ios/3.7.0/package/bin/update:21:13).
Read more >
Cannot find module 'unorm' - Ionic Angular
Hello everyone, I am trying to do build for the first time on iOS but getting this error, anyone knows how to solve...
Read more >
Cordova Build Android Fails: Cannot Find Module 'C ...
Solvedmeteor [cordova] Cannot find module 'is-property' I get this error after command meteor add-platform android. Commands: meteor create simple-todos (C:\ ...
Read more >
cannot build for iOS or Android: "Cannot find module 'q-io/fs ...
Hello, I currently have issues building my project for iOS and Android. Robins-MacBook-Air:app robin$ meteor add-platform ios => Errors ...
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