i finished upgrading to angular 11 and i have error in zlib library. I need this to convert a Ibuffer. When i uploading the project I get this error:
Error: ./node_modules/zlib/lib/zlib.js
Module not found: Error: Can't resolve './zlib_bindings' in '..\node_modules\zlib\lib'
The code:
const zlib = require('zlib');
const buffer = Buffer.from(data,'base64');
zlib.inflateSync(buffer, (err,buffer) => {
if (err) {
console.error('An error occurred:', err);
}
this.excelService.export("xxx" + `${base.name}`, buffer.toString());
});
I had similar problem but when trying to add firebase Admin SDK and thanks to some guy on github i just make a copy and then renamed the copy zlib/lib/zlib - Copy.js to zlib/lib/zlib_bindings.js and then it started working.
Link to github issue:
https://github.com/diegomura/react-pdf/issues/1678
Related
encountering with error ENOENT : rename filename,
am unable to understand this error why am facing can anyone help me out.
below is my code
mv(query.sourceLocation, query.targetLocation, {
mkdirp: true
}, function (err) {
if (err) return console.error(err+new Date());
res.end("moved");
});
I'm using the html-pdf module to generate pdfs, using the following code:
var ejs = require('ejs');
var fs = require('fs');
var pdf = require('html-pdf');
var build = function (template, data) {
var html = ejs.compile(fs.readFileSync(template, 'utf8'));
html = html(data);
return html;
}
pdf.create(build('views/print_templates/pm_export_pdf.ejs',
{rows:resolve(rows, user_rows, table_rows,
subproject_rows, milestone_rows, release_rows)}), pdfconfig)
.toFile(function (err, pdf) {
if (err)
return console.log(err);
res.sendFile(pdf.filename);
});
PDFconfig is the config variable for html-pdf. And resolve is my own db resolve function, which is not very relevant in this story.
When I run this locally on OSX 10.10 on my MacBook Pro this works like a charm. But when I run this on my server(centOS), I get the following error:
events.js:72
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at errnoException (net.js:904:11)
at Object.afterWrite (net.js:720:19)
Has this something to do with permissions maybe? I'm not really sure what I'm doing wrong..
I run the following versions:
Node: 0.10.31
Express: 4.10.7
html-pdf: 1.2.0
For future purposes:
I figured that I had to rebuild my node-modules. I think I accidentally copied the node-modules folder over to the test server on centOS, and phantomjs had build it's dependencies for OSX. I'm still not sure how the error that it threw correspondents with that, but it fixed it.
Also be sure that you have FreeType and fontconfiglib installed.
I'm grunt beginner. But whenever I install any kind of grunt library to handle images it does not work.
grunt-webshot, webshot, getPixels, node-image, node, gm, node-pngjs, imagemagick, node-png, png, get-pixels
grunt.registerTask("getPixels", "your description", function() {
var fs = require('fs') , gm = require('gm');
gm('source/templates/t1/images/menu_item_bg.png').size(function (err, size) {
grunt.log.writeln(size.width > size.height ? 'wider' : 'taller than you');
});
});
Silently fails. No error, no nothing (I get: Done, without errors). Does not enter callback.
Same is with other libraries I used.
Only grunt modules can be used in grunt? Dont Think so, it seems i can use any library by using require() and it should work. It works ok with require('path')
Any way I can debug it? Make it return some kind of error or fix this problem?
Edit
I wrote a makescreenshot.js script which I call with node
var webshot = require('webshot');
// also tried commented varians:
//webshot('google.com', 'google.jpg', function(err) {
//webshot('http://google.com', 'google.jpg', function(err) {
webshot('http://google.com', 'google.jpg', {}, function(err) {
console.log('console.log ERROR: ' + err);
});
It returns the following: console.log ERROR: Error: PhantomJS exited with return value 1
Seems I figured it somehow. The problem seemed to be not properly installed Microsoft Visual Studio I reinstalled MSVS 2013 Express and it started taking screens normally.
I am using node.js library called urllib (https://github.com/node-modules/urllib) to make http requests. But when I try to run the code I am getting below error:
Error: Hostname/IP doesn't match certificate's altnames
at SecurePair.<anonymous> (tls.js:1379:23)
at SecurePair.EventEmitter.emit (events.js:92:17)
at SecurePair.maybeInitFinished (tls.js:982:10)
at CleartextStream.read [as _read] (tls.js:469:13)
After my research, I found out that I need to add an option called rejectUnauthorized:false. So I added same using below code:
urllib.request(urlToCall, { rejectUnauthorized:false }, function (err, data, response) {
if(err) {
throw err;
}
});
But still I get the same error. Can anyone please guide me how to resolve this error? Since I am beginner to node and this error looks very strange to me, by the way I am using Ubuntu 12.0.4 LTS OS.
Im getting this error:
Error: Command failed: execvp(): Permission denied
When I do a simple node-imagemagick script:
im = require('imagemagick');
im.identify.path = '/tmp/node_thumbs/';
im.identify('cool.jpg',function(err,features){
if(err) throw err;
console.log(features);
});
Any ideas on what could be causing this?
The permission denied is from trying to launch the ImageMagick command, not in the process of executing it.
If you look at the documentation, identify.path is "Path to the identify program." In this case, you're redefining the path to the executable as /tmp/node_thumbs/, which presumably is not the executable.
You probably simply want:
var im = require("imagemagick");
im.identify('/tmp/node_thumbs/cool.jpg',function...