uWebSockets.js icon indicating copy to clipboard operation
uWebSockets.js copied to clipboard

MSVCP140 should not be needed

Open artknight opened this issue 3 years ago • 15 comments

Hi, I am getting this error Error: This version of µWS is not compatible with your Node.js build: after upgrading to 20.6.0.

I am running node v14.17.0

What is the new node version requirement?

artknight avatar Jan 14 '22 16:01 artknight

Node 14 to 17

e3dio avatar Jan 14 '22 16:01 e3dio

Node 14 to 17

So, node 14.17.0 should have worked then? Why didn't it?

artknight avatar Jan 14 '22 16:01 artknight

You can check each variable in this line https://github.com/uNetworking/uWebSockets.js/blob/binaries/uws.js#L20 process.platform process.arch process.versions.modules for your Node process, and make sure the matching binary is here https://github.com/uNetworking/uWebSockets.js/tree/binaries

e3dio avatar Jan 14 '22 16:01 e3dio

@e3dio here is the system dump

process {
  version: 'v16.13.2',
  versions: {
    node: '16.13.2',
    v8: '9.4.146.24-node.14',
    uv: '1.42.0',
    zlib: '1.2.11',
    brotli: '1.0.9',
    ares: '1.18.1',
    modules: '93',
    nghttp2: '1.45.1',
    napi: '8',
    llhttp: '6.0.4',
    openssl: '1.1.1l+quic',
    cldr: '39.0',
    icu: '69.1',
    tz: '2021a',
    unicode: '13.0',
    ngtcp2: '0.1.0-DEV',
    nghttp3: '0.1.0-DEV'
  },
  arch: 'x64',
  platform: 'win32',
  release: {
    name: 'node',
    lts: 'Gallium',
    sourceUrl: 'https://nodejs.org/download/release/v16.13.2/node-v16.13.2.tar.gz',
    headersUrl: 'https://nodejs.org/download/release/v16.13.2/node-v16.13.2-headers.tar.gz',
    libUrl: 'https://nodejs.org/download/release/v16.13.2/win-x64/node.lib'
  },

this file ./uws_win32_x64_93.node definitely exists, just checked

artknight avatar Jan 14 '22 17:01 artknight

I am running node v14.17.0

That says Node 16, you said Node 14. You should also confirm what version uWS.js you are running, check the node_modules/uWebSockets.js/package.json file and see what version it says

e3dio avatar Jan 14 '22 17:01 e3dio

I am running node v14.17.0

That says Node 16, you said Node 14. You should also confirm what version uWS.js you are running, check the node_modules/uWebSockets.js/package.json file and see what version it says

yes, i upgraded after you mentioned that its between 14-17

artknight avatar Jan 14 '22 17:01 artknight

{
  "name": "uWebSockets.js",
  "version": "20.6.0",
  "main": "uws.js",
  "types": "./index.d.ts"
}

artknight avatar Jan 14 '22 17:01 artknight

So it should be working for you, I can confirm Node 17 is working for the same system as yours, I don't have Node 16 set up to check

e3dio avatar Jan 14 '22 17:01 e3dio

ok lemme upgrade to 17

artknight avatar Jan 14 '22 17:01 artknight

@e3dio yeah that did not fix it.. Here is the actual error

D:\web\ws.cogency.io\node_modules\uWebSockets.js\uws.js:22
                throw new Error('This version of µWS is not compatible with your Node.js build:\n\n' + e.toString());
                ^

Error: This version of µWS is not compatible with your Node.js build:

Error: The specified module could not be found.
\\?\D:\web\example.com\node_modules\uWebSockets.js\uws_win32_x64_102.node
    at D:\web\example.com\node_modules\uWebSockets.js\uws.js:22:9
    at Object.<anonymous> (D:\web\example.com\node_modules\uWebSockets.js\uws.js:24:3)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (D:\web\example.com\app.js:2:13)
    at Module._compile (node:internal/modules/cjs/loader:1097:14)

Node.js v17.3.1

looks like the uws_win32_x64_102.node is not being found.. however it is there!

Also, not sure if this matters, I had v19.3.0 running successfully before the upgrade

artknight avatar Jan 14 '22 17:01 artknight

I see some things for Windows error "The specified module could not be found" for it not finding a DLL that it assumes to be there https://stackoverflow.com/questions/13471457/finding-dll-for-the-specified-module-could-not-be-found You could run Process Monitor and check for the error as described in link

e3dio avatar Jan 14 '22 18:01 e3dio

console.log(process.pid)
setTimeout(()=>require('uWebSockets.js'),15000)

Run that code, in Process Monitor add filter on that Process ID and start capturing events, then the module will try to load and look for error towards the end

e3dio avatar Jan 14 '22 18:01 e3dio

@e3dio Ok, I got it resolved! Here is what I did

  1. To check for missing dependencies, I downloaded the dependecy checker https://github.com/lucasg/Dependencies

  2. Once downloaded, I ran it on the uws_win32_x64_102.node module to determine if any dependencies were missing.

Indeed, three files needed to be downloaded

MSVCP140.dll
VCRUNTIME140.dll
VCRUNTIME140_1.dll
  1. The files are a part of the Visual Studio runtime env, so it really depends on how the node modules were compiled. In this case just downloading the packages was sufficient

https://aka.ms/vs/17/release/vc_redist.x86.exe https://aka.ms/vs/17/release/vc_redist.x64.exe

After installing and rebooting the server, the dependencies were found and I was able to run the WS server!

... just in case this helps someone =)

artknight avatar Jan 14 '22 19:01 artknight

I was going to say, looks like those 3 DLL were required

e3dio avatar Jan 14 '22 19:01 e3dio

https://docs.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-170#remarks

ghost avatar Jan 14 '22 23:01 ghost