Skip to content

Electron error from users: The specified module could not be found. \\?\C:\Users\... #87

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

Open
Janneman84 opened this issue Sep 4, 2017 · 8 comments

Comments

@Janneman84
Copy link

I am trying to integrate Bluetooth in my Electron app, so I use noble-uwp, which uses NodeRT. The problem is that it works fine on the machine that I generate the package on, but on other computers you'll get the error that module could not be found. The binding.node it's referring to is there though.

Then I tried the geolocation example from the readme, same problem, so I knew it's caused by NodeRT and not noble-uwp.

What I found was that it only works if Visual Studio 2015 with the Windows 10 SDK is installed. Is this normal? If so using it in Electron apps is pretty useless because every user would have to install VS2015 along with it.

This is probably related to #60

@nadavbar
Copy link
Member

nadavbar commented Sep 6, 2017

It's a general issue of deploying windows desktop apps..you need to make sure you have the set of DLLs that the app use.
What you'll probably want to do is to find the minimal set of DLLs that you need to package with your app.
This is a good place to start: https://www.microsoft.com/en-us/download/details.aspx?id=48145
As probably most of the DLLs are part of this package.
Another option is to use a dependency walker (http://www.dependencywalker.com/) on the native addon in order to see which DLLs are needed.

@Janneman84
Copy link
Author

Thanks the package worked! I dug some deeper and found that you need the dlls from this folder:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x64\Microsoft.VC140.CRT\

There are 4 dlls there, of which 2 are already present in Electron. Turns out that if you copy vccorlib140.dll to the app folder (where the .exe is) the module works again on every computer.

Maybe Electron should include all these dlls by default (not just the two), I'll suggest it.

@NAllred91
Copy link

@Janneman84 Adding these dlls to the "win-unpacked" directory (where the .exe is) worked for me if I just distribute that directory, but did you ever find any way to get these dlls included in the Setup.exe?

@Janneman84
Copy link
Author

I'm using electron-window-installer, where you can just specify a build folder. Put the dlls in the build folder and you're done. I don't know what you use to make installers.

@ErraticFox
Copy link

ErraticFox commented Apr 10, 2018

I'm stuck on this.
I've installed VS Express 2015, Windows 10 Development Kit, Visual C++ Redistributable for Visual Studio 2015 (x86) and (x64), and node-gyp.

I generate the namespace windows.media successfully using the UI. I open up the windows.media folder with a terminal and use this command node-gyp rebuild --target=1.8.4 --arch=x64 --dist-url=https://atom.io/download/atom-shell it builds successfully. I then move windows.media into my node_modules folder.

In my node script I have this:

const { MediaPlaybackStatus } = require('windows.media');

console.log(MediaPlaybackStatus);

when I run the script, I get

PS C:\Users\errat\Documents\Code\foobar> node app.js
C:\Users\errat\Documents\Code\foobar\node_modules\windows.media\lib\main.js:22
  throw e;
  ^

Error: The specified module could not be found.
\\?\C:\Users\errat\Documents\Code\foobar\node_modules\windows.media\build\Release\binding.node
    at Object.Module._extensions..node (module.js:672:18)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\errat\Documents\Code\foobar\node_modules\windows.media\lib\main.js:19:20)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)

I did get it working before as it did do the console.log, though just to be sure I was doing it right and I didn't just stumble across the answer, I deleted it and tried doing everything again and I cannot get it work.

This is currently a test folder with nothing but the node_modules folder, app.js, and package.json.

Also, how can I use dependency walker on a module? What file would I open with dependency walker?

@semireg
Copy link

semireg commented Feb 14, 2019

@Janneman84 how did you come to this conclusion:

I dug some deeper and found that you need the dlls from this folder:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\redist\x64\Microsoft.VC140.CRT\

I'm trying to use Dependency Walker but I don't know which file to walk. I've checked these but none load:

2019-02-14 at 10 51 am

Here's a screenshot of the sentry error:
2019-02-14 at 10 51 am

Pasting text here to keep the search crawlers happy:

\\?\C:\Users\Desktop-tle\AppData\Local\Temp\ce2f24a3-67e3-4d29-9fef-1c93b5e5e9ef.tmp.node
app:///node_modules/@sentry/node/src/integrations/console.ts in Function._load at line 37:43
Called from: internal/modules/cjs/loader.js in Module.require
app:///node_modules/@nodert-win10-rs3/windows.devices.enumeration/lib/main.js in Object.<anonymous> at line 25:20

@semireg
Copy link

semireg commented Feb 14, 2019

My fault. I had to give dependency walker more time. 🕙 It takes a minute to open the node file.

2019-02-14 at 11 25 am

I created a new folder app/win-dlls and copied vccorlib140.dll to it. Then, I added to package.json for electron-builder integration:

    "win": {
      "target": ["nsis"],
      "extraFiles": {
        "from": "app/win-dlls/"
      }
    },

Once built, I double-checked that vccorlib140.dll existed in win-unpacked

I was able to replicate the error by uninstalling all of the MS VS C++ programs, and then verify that a build of my app that includes vccorlib140.dll works without error. 💯 Thank you!

@steele-cjf
Copy link

I'm stuck on this. I've installed VS Express 2015, Windows 10 Development Kit, Visual C++ Redistributable for Visual Studio 2015 (x86) and (x64), and node-gyp.

I generate the namespace windows.media successfully using the UI. I open up the windows.media folder with a terminal and use this command node-gyp rebuild --target=1.8.4 --arch=x64 --dist-url=https://atom.io/download/atom-shell it builds successfully. I then move windows.media into my node_modules folder.

In my node script I have this:

const { MediaPlaybackStatus } = require('windows.media');

console.log(MediaPlaybackStatus);

when I run the script, I get

PS C:\Users\errat\Documents\Code\foobar> node app.js
C:\Users\errat\Documents\Code\foobar\node_modules\windows.media\lib\main.js:22
  throw e;
  ^

Error: The specified module could not be found.
\\?\C:\Users\errat\Documents\Code\foobar\node_modules\windows.media\build\Release\binding.node
    at Object.Module._extensions..node (module.js:672:18)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Module.require (module.js:587:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (C:\Users\errat\Documents\Code\foobar\node_modules\windows.media\lib\main.js:19:20)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)

I did get it working before as it did do the console.log, though just to be sure I was doing it right and I didn't just stumble across the answer, I deleted it and tried doing everything again and I cannot get it work.

This is currently a test folder with nothing but the node_modules folder, app.js, and package.json.

Also, how can I use dependency walker on a module? What file would I open with dependency walker?

same question,what is solution?

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

No branches or pull requests

6 participants