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

Compilation of µWebSockets has failed and there is no pre-compiled binary available for your system #246

Closed
iMoses opened this issue Nov 17, 2016 · 33 comments

Comments

@iMoses
Copy link

iMoses commented Nov 17, 2016

[Error] Error: Compilation of µWebSockets has failed and there is no pre-compiled binary available for your system. Please install a supported C++11 compiler and reinstall the module 'uws'.

I can't seem to get SocketCluster to work, I always get the above error message, even after I changed wsEngine to ws.
I tried it on Node 6 and 7, Ubuntu 16.04.
I couldn't find anymore information about this issue online, can you please direct me on how to figure out what is causing this issue?

Thanks

@jondubois
Copy link
Member

jondubois commented Nov 17, 2016

@iMoses Is this happening when you do npm install?
It works fine on my Ubuntu 15.10 machine with Node 6.4.0. It sounds like it doesn't like your compiler for some reason... @alexhultman do you know what the issue could be?

Worst case, you can try running SC inside Docker (if you have Docker installed)... See https://blog.baasil.io/framework-in-a-container-6105d3275d61#.nrqmc559j - See the last part

@iMoses
Copy link
Author

iMoses commented Nov 17, 2016

No, npm install goes smoothly.
I get this message on a loop when trying to run a worker, it keeps crashing.

What information can I provide that will assist?
I need to get it working as part of an electron application, so docker is not really an option.

@jondubois
Copy link
Member

Alex said that it can happen if you have an unusual setup like maybe 32-bit machine instead of 64-bit or maybe you have an old compiler - Or something happened to it... I'm trying to find a workaround now.

@jondubois
Copy link
Member

It's weird that you can't just use ws.

@jondubois
Copy link
Member

@iMoses When I delete the uws module and set the wsEngine to ws (http://socketcluster.io/#!/docs/api-socketcluster), it still works for me - Maybe try deleting uws from node_modules directory.

@iMoses
Copy link
Author

iMoses commented Nov 17, 2016

64-bit, on two different PCs with Ubuntu 16.04
Both were bought in the last 18 months, both are strong PCs

It seems that the worker crashes just by trying to import uws

1479419902894 - Origin: Worker (PID 5931)
   [Error] Error: Compilation of µWebSockets has failed and there is no pre-compiled binary available for your system. Please install a supported C++11 compiler and reinstall the module 'uws'.
    at e (/home/imoses/repos/tools_client/app/node_modules/uws/uws.js:25:19)
    at Object.<anonymous> (/home/imoses/repos/tools_client/app/node_modules/uws/uws.js:29:3)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at EventEmitter.SCServer (/home/imoses/repos/tools_client/app/node_modules/socketcluster-server/scserver.js:83:18)
1479419902896 - Worker 0 exited - Exit code: 1
1479419903031 - Origin: Worker (PID 5936)
   [Error] Error: Compilation of µWebSockets has failed and there is no pre-compiled binary available for your system. Please install a supported C++11 compiler and reinstall the module 'uws'.
    at e (/home/imoses/repos/tools_client/app/node_modules/uws/uws.js:25:19)
    at Object.<anonymous> (/home/imoses/repos/tools_client/app/node_modules/uws/uws.js:29:3)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at EventEmitter.SCServer (/home/imoses/repos/tools_client/app/node_modules/socketcluster-server/scserver.js:83:18)
1479419903033 - Worker 0 exited - Exit code: 1

This goes on and on and on...

@iMoses
Copy link
Author

iMoses commented Nov 17, 2016

I tried deleting node_modules several times already.. no luck

@jondubois
Copy link
Member

Did you try doing npm cache clean before reinstalling?

@jondubois
Copy link
Member

@iMoses What is your uname -a?

@iMoses
Copy link
Author

iMoses commented Nov 17, 2016

Linux imoses-pc 4.4.0-45-generic #66-Ubuntu SMP Wed Oct 19 14:12:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

I haven't tried npm cache clean until now, it does seem to have changed something.
I think I have a bigger bug here that may not belong to you.
For some reason, SocketCluster still ignores my wsEngine: 'ws' but it does seem to work:

   [Busy] Launching SocketCluster
   >> Worker PID: 8426
   [Active] SocketCluster started
            Version: 5.0.24
            Environment: dev
            WebSocket engine: uws
            Port: 8000
            Master PID: 8407
            Worker count: 1
            Broker count: 1

But when I try to run it as part of an electron application I still get the same error messages.

@jondubois
Copy link
Member

jondubois commented Nov 17, 2016

Did you use npm link to link SC into your project? I noticed it wouldn't update modules correctly on some occasions for me. I just tested it and it definitely lets me switch; maybe it's not actually running the code you think it is.

@iMoses
Copy link
Author

iMoses commented Nov 17, 2016

No, it was installed as a regular dependency.

@iMoses
Copy link
Author

iMoses commented Nov 17, 2016

The part about wsEngine was my bad, I was indeed loading configuration from the wrong place.

Thanks a lot for you help

@iMoses iMoses closed this as completed Nov 17, 2016
@CoolHandLuke88
Copy link

CoolHandLuke88 commented Jan 15, 2018

I ran into this exact issue.
I wanted to leave this here for anyone else that may run into this issue with docker and uws installation.

Hope you guys don't mind I drop this here.

In Dockerfile


FROM node:8.9-alpine

RUN apk add --update \
libc6-compat


Needed libc6-compact

This should resolve the issue seen below.

Error: Compilation of µWebSockets has failed and there is no pre-compiled binary available for your system. Please install a supported C++11 compiler and reinstall the module 'uws'.

@seclace
Copy link

seclace commented Mar 14, 2018

As a workaround I run cd node_modules/uws and node-gyp rebuild commands.
(This module is used by socket cluster server in my react-native project).
Consider that your python binary has version is > 2.5 and < 3.0.0, node-gyp uses python for it.

Command Value
uname -a Darwin here's my name 16.7.0 Darwin Kernel Version 16.7.0: Mon Nov 13 21:56:25 PST 2017; root:xnu-3789.72.11~1/RELEASE_X86_64 x86_64
node -v v8.9.4
npm -v 5.6.0
python --version Python 2.7.10

@cjmling
Copy link

cjmling commented Mar 16, 2018

Update : April, 2019
Since my own comment below didn't help me when i had this problem again. Here how i solved it. ( for my own reference and maybe someone else too)
I use virtualbox + windows 10

  1. update to latest npm sudo npm install -g npm@latest both in windows and VM
  2. npm install from outside VM
  3. npm rebuild uws from inside VM

Had this same problem. And I got it solved by

Delete node_modules folder then npm install which download everything again DIDN'T SOLVE

Delete node_modules\uws folder then npm install which only re download uws SOLVED

@brunolemos
Copy link

brunolemos commented Apr 20, 2018

I was able to fix this way:

  1. Install the LTS version of nodejs (I used the command npx n lts)

  2. Run:

rm -rf node_modules/
npm install
pushd node_modules/uws
npm install
popd
npm start -- --reset-cache

EDIT: If using react-native, you may also need to do this first:

brew install watchman
npm install -g react-native-cli
watchman watch-del-all && rm -rf $TMPDIR/react-*
(and then run the commands above)

@ghoshabhi
Copy link

@cjmling's solution works!

@dotbloup
Copy link

dotbloup commented May 8, 2018

Using node 10, npm 5.6 and python 2.7.14, I have tried the solution from @cjmling but there is a built error. after typing npm i uws, "make" failed during built of uws. in node_modules/uws/build_log.txt
Does it mean the issue is related to the uws package?

make: *** [Release/obj.target/uws/src/addon.o] Error 1
make: Leaving directory `/root/seoserverdev2/node_modules/uws/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Linux 3.10.0-514.el7.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/seoserverdev2/node_modules/uws
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

The file is really long so it is attached
build_log.txt

@boogerlad
Copy link

boogerlad commented May 9, 2018

have the same problem

@klren0312
Copy link

I don't use the alpine ,fix it

@hiepxanh
Copy link

still cannot fix

@dotbloup
Copy link

dotbloup commented May 26, 2018

Here is what I did as a workaround to fix the issue, I added SOCKETCLUSTER_WS_ENGINE='ws' to a .env file in the main root path and I added require('dotenv').config(); at the top of my server.js

So, rather than using uws, i use ws. I also discovered that ws was maintained by many more people than uws.

Alternative: replace wsEngine: process.env.SOCKETCLUSTER_WS_ENGINE || 'uws' by
wsEngine: process.env.SOCKETCLUSTER_WS_ENGINE || 'ws' in server.js

do something similar for scc-state / scc-broker

@ghost
Copy link

ghost commented Jun 2, 2018

tried all of the above no luck

@dotbloup
Copy link

dotbloup commented Jun 2, 2018

@Cryptoking117 i have updated my answer.

@sp-suresh
Copy link

sp-suresh commented Jul 15, 2018

In my case installing latest nodejs and npm on Ubuntu(16.04) with PPA, solved this problem.

Earlier version

node - v6.14.3
npm - 3.10.10

Latest version which solved the problem-

node - v10.6.0
npm - 6.1.0

Refer - How to Install Latest Node.js and NPM on Ubuntu with PPA

@anton-mladenov
Copy link

anton-mladenov commented Sep 29, 2018

hey developers of SocketCluster, check this out: https://www.npmjs.com/package/uws
sharing the link above because of the message I got when I ran yarn upgrade which is:

warning remotedev-server > socketcluster > socketcluster-server > uws@8.14.0: stop using this version

so, now the question is which version should I use? how can I change the version I am using?

@pbassut
Copy link

pbassut commented Oct 21, 2018

For me the program was node 10.
When downgrading to node 9 it worked.
nvm use 9
rm -rf node_modules/
npm install

@vickylance
Copy link

For me the program was node 10.
When downgrading to node 9 it worked.
nvm use 9
rm -rf node_modules/
npm install

I downgraded to node 8 and it worked thanks 👍

@nicubarbaros
Copy link

@pbassut thank you

@paxperscientiam
Copy link

Thanks @vickylance , I downgraded to 9 and that worked for me too.

@stephben
Copy link

uws will never ever work with nodejs10. That is because uws does not support openssl 1.1.1.
That is the reason uws works when downgrading to node 8 (openssl 1.0.2).
Since the author has pulled his source out of nodejs repository I doubt there will ever be any support.

@justgeek
Copy link

justgeek commented Feb 9, 2023

Just run the command using this flag --wsEngine=ws

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