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'
Steps leading to the issue
npm i -g socketcluster
socketcluster create myApp && cd myApp (npm installs uws without errors)
node server.js (it errors here, on require)
Full stacktrace
[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 native (C:\code\wsApp\node_modules\socketcluster-server\node_modules\uws\uws.js:25:19)
at Object.<anonymous> (C:\code\wsApp\node_modules\socketcluster-server\node_modules\uws\uws.js:29:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at SCServer (C:\code\wsApp\node_modules\socketcluster-server\scserver.js:83:18)
Additional details
- Windows 10, Node.js 7.2.0, npm 3.10.9, socketcluster v5.1.3, node-gyp v3.4.0
- I already have MinGW
g++ (x86_64-posix-seh-rev1, Built by MinGW-W64 project) 6.2.0 Copyright (C) 2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - I also have Visual Studio 2015 Community Edition installed, along with Visual C++ 2015 build tools installed
- I tried going into the myApp directory and running
npm install uwsagain, but it does nothing.
Output from socketcluster create myApp
λ socketcluster create myApp && cd myApp
Creating app structure...
Installing app dependencies using npm. This could take a while...
npm WARN deprecated [email protected]: use uuid module instead
> [email protected] install C:\code\myApp\node_modules\uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0
> [email protected] postinstall C:\code\myApp\node_modules\spawn-sync
> node postinstall
[email protected] C:\code\myApp
+-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| `-- [email protected]
+-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | | `-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| `-- [email protected]
+-- [email protected]
+-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| `-- [email protected]
+-- [email protected]
| `-- [email protected]
+-- [email protected]
+-- [email protected]
| `-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| | +-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | | `-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | `-- [email protected]
| | | +-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | | `-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | `-- [email protected]
| | `-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| `-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| `-- [email protected]
+-- [email protected]
| +-- [email protected]
| +-- [email protected]
| `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| `-- [email protected]
| `-- [email protected]
+-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| | `-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | `-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | | `-- [email protected]
| | | +-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | | +-- [email protected]
| | | | | `-- [email protected]
| | | | `-- [email protected]
| | | `-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | `-- [email protected]
| | | `-- [email protected]
| | +-- [email protected]
| | | `-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | `-- [email protected]
| | | `-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | `-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | `-- [email protected]
| +-- [email protected]
| `-- [email protected]
`-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]
+-- [email protected]
`-- [email protected]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
[Success] SocketCluster sample 'C:\code\myApp' was setup successfully.
Contents of node_modules/uws directory
λ ls node_modules/uws
LICENSE binding.gyp package.json uws.js uws_darwin_47.node uws_linux_46.node uws_linux_48.node
README.md build_log.txt src/ uws_darwin_46.node uws_darwin_48.node uws_linux_47.node uws_win32_48.node*
I took a look at node_modules/uws/build_log.txt, it seems node-gyp errored due to Python 3. I ran npm config set python C:\Python27\python.exe and it works now.
same error, but my uws/build_log.txt says
D:\XodoV3\app\node_modules\uws>if not defined npm_config_node_gyp (node "C:\Users\kk\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: unable to verify the first certificate
gyp ERR! stack at TLSSocket.<anonymous> (_tls_wrap.js:1098:38)
gyp ERR! stack at emitNone (events.js:105:13)
gyp ERR! stack at TLSSocket.emit (events.js:207:7)
gyp ERR! stack at TLSSocket._finishInit (_tls_wrap.js:628:8)
gyp ERR! stack at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:458:38)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\kk\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\XodoV3\app\node_modules\uws
gyp ERR! node -v v8.1.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
anyone knows what it means?
@liuqimin323 What is your Node.js version? What is your SocketCluster server version (npm ls socketcluster-server)? What is your uws version (npm ls uws)?
Maybe try upgrading everything to the latest version.
I have it solved by downgrade my node js to 6.11.1, thanks!
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'.
@prashcr work for me.
I drill down node_modules/socketcluster-server/node_modules/uws/build_log.txt find it needs python 2.x to build.
So set python 2.x as default (npm config set python $(which python2) may also work).
on windows 10 you need C++ windows build tools
https://www.npmjs.com/package/windows-build-tools
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
I had to remove uws and then install uws to fix this on my "New" laptop.
I have aliases for g++ and gcc pointing to clang (I guess all Macs do), so why can't it find a C++ compiler? 🤔