Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IONIC 4 Failed to install cordova-plugin-connectsdk: Error: Cannot find module internal/util/types #77

Open
maykoestevez opened this issue Sep 26, 2018 · 10 comments · May be fixed by #79

Comments

@maykoestevez
Copy link

Hello, thanks for this good plugin it really helps.

installing the plugin Im getting this:

Failed to install 'cordova-plugin-connectsdk': Error: Cannot find module 'internal/util/types'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.Module._load (module.js:475:25)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at evalmachine.<anonymous>:31:26
    at Object.<anonymous> (/Users/User/Desktop/Projects/project/project/plugins/cordova-plugin-connectsdk/scripts/node_modules/unzip/node_modules/fstream/node_modules/graceful-fs/fs.js:11:1)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)

Cordova
8.0.0

Node
v8.12.0

npm
6.4.1

IONIC
4.1.2

@ClosetGeek-Git
Copy link

ClosetGeek-Git commented Oct 16, 2018

Same issue using vanilla Cordova (no Ionic)

Failed to install 'cordova-plugin-connectsdk': Error: Cannot find module 'internal/util/types'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
    at Function.Module._load (internal/modules/cjs/loader.js:506:25)
    at Module.require (internal/modules/cjs/loader.js:636:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at evalmachine.<anonymous>:44:31
    at Object.<anonymous> (/home/jason/dev/rokuremote/rokuremote/plugins/cordova-plugin-connectsdk/scripts/node_modules/unzip/node_modules/fstream/node_modules/graceful-fs/fs.js:11:1)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
Cannot find module 'internal/util/types'

cordova -v:
8.1.2 ([email protected])

node -v:
v10.12.0

npm -v:
6.4.1

OS is up-to-date Ubuntu 16.04 LTS amd 64 bit; NPM, Node and Cordova installed via standard repositories.

@jkerb8
Copy link

jkerb8 commented Oct 18, 2018

Having this same exact issue here.

cordova - 8.1.2
node - v10.10.0
npm - 6.4.1

OS is Ubuntu 18.04.1 LTS. This is the only plugin that I've tried to add to my project that I've had installation issues with.

@devshisiyani
Copy link

I have the same issue.
I have un-installed node js and re-installed without any success.
npm -v
6.5.0
node -v
v10.14.2
cordova -v
8.1.2 ([email protected])

My OS is windows 10.
I have created a simple project hello

error
Subproject Path: cordova-plugin-connectsdk/hello-Connect-SDK-Android
Failed to install 'cordova-plugin-connectsdk': Error: Cannot find module 'internal/util/types'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)

Any workaround and fix would be appreciated.

@powysm
Copy link

powysm commented Dec 20, 2018

I am seeing similar on a vanilla cordova.

npm -v
6.5.0
node -v
v8.10.0
cordova -v
8.1.2 ([email protected])

I am on ubuntu.

I have read a few other posts and have tried npm audit fix and npm rebuild.
removing node_modules and re-added all with no avail.

@vineeth059
Copy link

same here

Lindsay-Needs-Sleep added a commit to miloproductionsinc/corodva-plugin-connect-sdk that referenced this issue Aug 19, 2019
This fixes ConnectSDK#77
Fixes "Error: Cannot find module internal/util/types"
and Fixes "Failed to install 'cordova-plugin-connectsdk': Error: Cannot find module 'setimmediate'"
@Lindsay-Needs-Sleep
Copy link

I just submitted a pull request which fixes this issue for me on Cordova 9.0.0

I think it will work other versions as well.

Basically, the required node_modules were committed to the repo and were not dynamically retrieved by node before install. So removing the hard-coded node_modules and adding them to the dependencies seems to have worked. (I'm thinking the hard-coded node_modules worked with a specific version of Cordova which included the node_modules' dependencies as part of the platform but have since been removed or changed.)

Lindsay-Needs-Sleep added a commit to miloproductionsinc/corodva-plugin-connect-sdk that referenced this issue Aug 21, 2019
This fixes ConnectSDK#77
Fixes "Error: Cannot find module internal/util/types"
and Fixes "Failed to install 'cordova-plugin-connectsdk': Error: Cannot find module 'setimmediate'"
@pgcan
Copy link

pgcan commented Sep 6, 2019

I just submitted a pull request which fixes this issue for me on Cordova 9.0.0

I think it will work other versions as well.

Basically, the required node_modules were committed to the repo and were not dynamically retrieved by node before install. So removing the hard-coded node_modules and adding them to the dependencies seems to have worked. (I'm thinking the hard-coded node_modules worked with a specific version of Cordova which included the node_modules' dependencies as part of the platform but have since been removed or changed.)

Hi @Lindsay-Needs-Sleep, did u get the cordova project compiled after you successfully added the plugin? I was able to add the plugin using your fork but then no luck in building the cordova project. I tried fixing build.gradle but everytime it throws new error. Can you please help?

@Lindsay-Needs-Sleep
Copy link

Hi @pgcan!

Sure, what error did you get?

(If you haven’t done this) You can also try deleting these 3 folders:
node_modules
platforms
plugins

and then running “cordova prepare android” again

@pgcan
Copy link

pgcan commented Sep 6, 2019

Hi @pgcan!

Sure, what error did you get?

(If you haven’t done this) You can also try deleting these 3 folders:
node_modules
platforms
plugins

and then running “cordova prepare android” again

Thanks @Lindsay-Needs-Sleep for your quick response, after struggling a whole day I removed this plugin and now I am trying another plugin (cordova-plugin-presentation). I will get back to you if I decide to use this plugin again.

@Lindsay-Needs-Sleep
Copy link

For sure!

To be fair, I also moved away from this plugin, I wasn’t able to get the plugin working the way I had hoped and due to development difficulty I left [submodules are the worst o.o]. I went back to trying to get cordova-plugin-chromecast to work properly. Maybe in the distant future I will return. The potential of this plugin is much greater I think.

Please share how cordova-plugin-presentation goes! (For future readers :) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
8 participants