NodeJS script on Docker: /lib64/libz.so.1: version `ZLIB_1.2.9' not found - node.js

I use sharp library for my image processing in the node js script which in turn is running my test cases using jest-image-snapshot.
I have got this error
/lib64/libz.so.1: version `ZLIB_1.2.9' not found
Found similar issue on NodeJS app on OpenShift: /lib64/libz.so.1: version `ZLIB_1.2.9' not found
and tried preloading the dependency.
But then, I have got error on preloading as well
ERROR: ld.so: object '/opt/app-root/src/node_modules/sharp/vendor/lib/libz.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
Please help to resolve this..
I have been trying this in my Windows OS
NOTE: The same script works fine in a mac OS

Related

electron-builder installer: A JavaScript error occurred in the main process, Error: The specified module could not be found

I am using electron 11.1.0 and electron-builder 22.10.5
I created a installer for my electron app which is using native module using electron-builder and its working fine on my laptop but on my friends laptop I am getting error
A JavaScript error occurred in the main process
Uncaught Exception:
Error: The specified module could not be found.
\\?C:\some\path\My-Electron-App\resources\app.asar.unpacked\node_modules\obs-studio-node\obs_studio_client.node
I have checked C:\some\path\My-Electron-App\resources\app.asar.unpacked\node_modules\obs-studio-node\obs_studio_client.node file exists.
I guess its asar related issue with native module. I tried by adding "asarUnpack": ["**/*.node"] in my build config but does not help.
How can I fix this problem?
I could not get this working with asarUnpack. Instead I use
"asar": false
Increases the bundle size, but at least it works.

'node-jose' library is using 'zlib' library as a dependency which throws an error. How do I fix it and have you encountered the same problem?

I'm trying to use the node-jose library with angular7 for the use with JWEs. The library uses zlib as a dependency and it throws an error when compiling:
ERROR in ./node_modules/zlib/lib/zlib.js
Module not found: Error: Can't resolve './zlib_bindings' in '~\WebApp\node_modules\zlib\lib'
I opened the 'zlib.js' file and the contents are the following:
module.exports = require('./zlib_bindings');
The problem is that the required file doesn't exist. I inspected the rest of the library and there is no such file in the whole library.
I searched the whole internet and no one has described the same problem as I have. There are some discussions regarding the 'node-jose' library but none of those issues are related to 'zlib'.
I would be extremely thankful if only someone would say they share the same error. Thanks in advance!
I found the answer.
Angular isn't showing an error when compiling but shows an error in the browser. It's because the browser doesn't have 'node' libraries integrated so it can't start the 'zlib' library. Installing the 'zlib' library in 'node_modules' doesn't help since it's deprecated.
Using the 'browserify-zlib' library and changing the ...require('browserify-zlib') in all my dependencies has fixed the issue.
This PR will fix the issue in node-jose
https://github.com/cisco/node-jose/pull/264
This is published to npm as node-jose-browserify, https://www.npmjs.com/package/node-jose-browserify
npm i node-jose-browserify

Error in installing/ running serialport in node.js

Have been trying to installing/ running 'serialport' on Node.js but it fails.
First I tried installing the current version 0.7.3 and it fails with the following errors
Waf: Leaving directory `/home/anand/node/node_modules/serialport/serialport_native/build'
'build' finished successfully (0.237s)
cp: cannot stat `build/Release/serialport_native.node': No such file or directory
Next I tried installing version 0.6.7. It installs correctly but when I try to run the examples I get the following error
Error: Unable to load shared library /home/anand/node/node_modules/serialport/serialport_native.node
I have checked that the library exists and has read/write/execute permissions.
I have also checked with different versions of Node including 0.6.4, 0.6.10

experienced issue with expressjs/nodejs after updating connect

I am currently using the following versions of node & express (ubuntu):
node: 0.6.12
express: 2.5.8
I believe I am using connect v2.0.3.
The error spawns from the http/https.js files inside the express/lib/http.js files (I am referencing http/https in my main app js file):
TypeError: Cannot read property 'prototype' of undefined
express/lib/http.js:50:35
Any thoughts would be welcome on how to resolve the issue - do I need to change the connect version being used or some other solution that can be used to resolve the issue.
Thanks.
Even though the readme file says that it's compatible with node 0.6x, I've generally had plenty of issues with connect and have solved them by installing an older version of it. Try the latest of v1 - npm install connect#1.8.6

Node js Error: Unable to load shared library

I'm trying to require any NodeJs addon that used "node-waf configure build" when installed with no luck. I keep getting the same message:
Error: Unable to load shared library /Users/xxxx/node_modules/pdfkit/node_modules/flate/lib/zlib_bindings.node
Error: Unable to load shared library /Users/xxxx/node_modules/rsa/rsaBinding.node
Error: Unable to load shared library /Users/xxxx/node_modules/dcrypt/build/default/dcrypt.node
addons I tried:
pdfkit, rsa, dcrypt
I'm on MacOsx 10.6.8, nodejs v0.6.5, npm .1.0-alpha-6
I encountered same problem with bcrypt and found it's because my node was 32bit and bcrypt was build as 64bit. After I build a 64bit node, all things work fine now.
PDFKit now uses the builtin zlib module from Node instead of the old flate dependency.

Resources