Error: write EPIPE while using imagemagick To write a lambda function - javascript

var gm = require("gm").subClass({ imageMagick: true });
function conversion(image) {
const image = gm(image);
image.orientation(function(err, value) {
if (err) {
console.log("Error Occurred :",err);
}
}
While accessing image.orientation this is the error which occurs.
Error: write EPIPE
at afterWriteDispatched (internal/stream_base_commons.js:154:25)
at writeGeneric (internal/stream_base_commons.js:145:3)
at Socket._writeGeneric (net.js:786:11)
at Socket._write (net.js:798:8)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at gm._spawn (/var/task/node_modules/gm/lib/command.js:253:18)
at gm._exec (/var/task/node_modules/gm/lib/command.js:190:17)
at gm.proto.<computed> [as orientation] (/var/task/node_modules/gm/lib/getters.js:68:12) {
errno: 'EPIPE',
code: 'EPIPE',
syscall: 'write'
}
These are some steps which i have already performed.
i have tried installing both imagemagick and graphicsmagick. https://www.npmjs.com/package/gm
Also there was suggestion to reinstall imagemagick and graphicsmagick and testing after restarting system. it also didn't worked
i am using Ubuntu , npm gm version:"^1.23.1", node version : nodejs12.x

Related

TypeError: concurrently(...).then is not a function

I was trying to run a github program from https://github.com/StartBootstrap/sb-clean-blog-angular .
I faced this error when I run the command "npm start".
D:\Full-Stack-Development-Capstone\Frontend\sb-clean-blog-angular-1.2.0\scripts\start.js:14
}).then(success, failure);
^
TypeError: concurrently(...).then is not a function
at Object.<anonymous> (D:\Full-Stack-Development-Capstone\Frontend\sb-clean-blog-angular-1.2.0\scripts\start.js:14:4)
at Module._compile (node:internal/modules/cjs/loader:1112:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1166:10)
at Module.load (node:internal/modules/cjs/loader:988:32)
at Module._load (node:internal/modules/cjs/loader:834:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
Node.js v18.4.0
The script code
const concurrently = require('concurrently');
const port = process.env.PORT || 4200;
concurrently([
{ command: 'node scripts/pug-watch.js', name: 'PUG_WATCH', prefixColor: 'bgGreen.bold' },
{
command: `npm run ng -- serve --port ${port} --open`,
name: 'NG_SERVE',
prefixColor: 'bgBlue.bold',
}
], {
prefix: 'name',
killOthers: ['failure', 'success'],
}).then(success, failure);
function success() {
console.log('Success');
}
function failure() {
console.log('Failure');
}
Hi to fix this simply do this
const { result } = concurrently([
{ command: 'node scripts/pug-watch.js', name: 'PUG_WATCH', prefixColor: 'bgGreen.bold' },
{
command: `npm run ng -- serve --port ${port} --open`,
name: 'NG_SERVE',
prefixColor: 'bgBlue.bold',
}
], {
prefix: 'name',
killOthers: ['failure', 'success'],
});
result.then(success, failure);
can read more on it here.
https://github.com/open-cli-tools/concurrently#api

Nodejs sequelize RangeError using mysql

I'm using sequelize in nodejs along with mysql. I'm trying to run the command npx sequelize db:create but it giving me this error. Not sure what to do here. Any help is appreciated. Thank you.
Sequelize CLI [Node: 14.17.4, CLI: 6.2.0, ORM: 6.6.2]
Loaded configuration file "src/config.js".
Using environment "development".
internal/buffer.js:83
throw new ERR_OUT_OF_RANGE(type || 'offset', RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range.
It must be >= 0 and <= 5. Received 9 at boundsError (internal/buffer.js:83:9)
at Buffer.readUInt32LE (internal/buffer.js:217:5)
at Packet.readInt32 (/root/sequelize-test/node_modules/mysql2/lib/packets/packet.js:103:24)
at Function.fromPacket (/root/sequelize-> > test/node_modules/mysql2/lib/packets/handshake.js:63:32)
at ClientHandshake.handshakeInit (/root/sequelize-test/node_modules/mysql2/lib/commands/client_handshake.js:93:40)
at ClientHandshake.execute (/root/sequelize-test/node_modules/mysql2/lib/commands/command.js:39:22)
at Connection.handlePacket (/root/sequelize-test/node_modules/mysql2/lib/connection.js:425:32)
at PacketParser.onPacket (/root/sequelize-test/node_modules/mysql2/lib/connection.js:75:12)
at PacketParser.executeStart (/root/sequelize-test/node_modules/mysql2/lib/packet_parser.js:75:16) at Socket. (/root/sequelize-test/node_modules/mysql2/lib/connection.js:82:25)
at Socket.emit (events.js:400:28) at addChunk (internal/streams/readable.js:290:12)
at readableAddChunk (internal/streams/readable.js:265:9)
at Socket.Readable.push (internal/streams/readable.js:204:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23) { code: 'ERR_OUT_OF_RANGE' }
my config of database
module.exports = {
development: {
username: 'root',
password: 'root123456',
database: 'test_run',
host: 'localhost',
port: 33060,
dialect: 'mysql',
timezone: '+06:00',
// dialectOptions: {
// bigNumberStrings: true,
// },
},
};
Make sure that you have globally installed MySQL2 using this command:
npm i -g mysql2
If the problem persists, try downgrading node version to 10.
Regards

Smart contracts won't deploy to a goQuorum blockchain

I installed goQuorum with quorum-wizard with 4 quorum nodes and 4 tessera nodes on IBFT. When I start the network with "./start.sh" I get
Starting Quorum network...
Waiting until all Tessera nodes are running...
Waiting until all Tessera nodes are running...
All Tessera nodes started
Starting Quorum nodes
Successfully started Quorum network.
--------------------------------------------------------------------------------
Tessera Node 1 public key:
BULeR8JyUWhiuuCMU/HLA0Q5pzkYT+cHII3ZKBey3Bo=
Tessera Node 2 public key:
QfeDAys9MPDs2XHExtc84jKGHxZg/aj52DTh0vtA3Xc=
Tessera Node 3 public key:
1iTZde/ndBHvzhcl7V68x44Vx7pl8nwx9LqnM/AfJUg=
Tessera Node 4 public key:
oNspPPgszVUFw0qmGFfWwh1uxVUXgvBxleXORHj07g8=
--------------------------------------------------------------------------------
when I run "nmap -p 21000-21100" I get
21000/tcp open irtrans
21001/tcp open unknown
21002/tcp open unknown
21003/tcp open unknown
This is my truffle-config.js
const HDWalletProvider = require("#truffle/hdwallet-provider");
const mnemonic = "not my real mn mon ic num phrase dum get l gg";
module.exports = {
networks: {
rinkeby: {
provider: function() {
return new HDWalletProvider(mnemonic, "https://rinkeby.infura.io/v3/"+mnemonic);
},
network_id: '*',
timeoutBlocks: 100000,
networkCheckTimeout:2000000
},
quorum: {
provider: function() {
return new HDWalletProvider(mnemonic, "http://127.0.0.1:21000/", chainId=10);
},
network_id: '*',
type: 'quorum',
timeoutBlocks: 100000,
networkCheckTimeout:2000000
},
compilers: {
solc: {
version: "0.5.0",
settings: {
optimizer: {
enabled: true, // Default: false
runs: 1000 // Default: 200
},
evmVersion: "homestead" // Default: "byzantium"
}
}
}
};
When I cd in to the directory with the truffle-config.js and I run truffle deploy --reset --network quorum to compile my smart contracts I get the following error.
Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.
/root/dapp1/Dapp/node_modules/web3-core-helpers/src/errors.js:42
return new Error(message);
^
Error: PollingBlockTracker - encountered an error while attempting to update latest block:
Error: Invalid JSON RPC response: ""
at Object.InvalidResponse (/root/dapp1/Dapp/node_modules/web3-core-helpers/src/errors.js:42:16)
at XMLHttpRequest.request.onreadystatechange (/root/dapp1/Dapp/node_modules/web3-providers-http/src/index.js:92:32)
at XMLHttpRequestEventTarget.dispatchEvent (/root/dapp1/Dapp/node_modules/xhr2-cookies/xml-http-request-event-target.ts:44:13)
at XMLHttpRequest._setReadyState (/root/dapp1/Dapp/node_modules/xhr2-cookies/xml-http-request.ts:219:8)
at XMLHttpRequest._onHttpRequestError (/root/dapp1/Dapp/node_modules/xhr2-cookies/xml-http-request.ts:379:8)
at ClientRequest.<anonymous> (/root/dapp1/Dapp/node_modules/xhr2-cookies/xml-http-request.ts:266:37)
at ClientRequest.emit (events.js:315:20)
at Socket.socketOnEnd (_http_client.js:493:9)
at Socket.emit (events.js:327:22)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
at PollingBlockTracker._performSync (/root/dapp1/Dapp/node_modules/eth-block-tracker/src/polling.js:51:24)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
I can deploy the smart contracts to rinkeby test net within this environment but I can't get smart contracts to deploy to quorum
I am using
Node v14.16.1
Ubuntu 18.04 (64 Bit)
Quorum 21.1.0
Web3.js v1.3.5
Truffle v5.3.4 (core: 5.3.4)
solidity v0.5.0
I've not used truffle with HDWalletProvider, which I believe is from an older version of Truffle. I'm not certain that will set up the node connection.
We would normally set up the configuration like the following in the quorum: {} section:
host: "localhost",
port: 22001,
type: "quorum"
I would suggest using that and see if it works.
Take a look at the truffle docs for working with quorum: https://www.trufflesuite.com/docs/truffle/distributed-ledger-support/working-with-quorum
Did you change from the default ports in the quorum-wizard?
The default for the node 1 RPC is 22000, the 21000 range is for p2p networking.
I would set the host and port per Satpal's answer above, as in the hdwallet documentation here.

EACCES error using spawnSync with CUPS command-line

I'm heaving problems with permission on running this CUPS command : cancel -a where -a is the option to cancel all jobs on all printers.
this is all the output in console:
error: Error: spawnSync /home/finsoft EACCES
at Object.spawnSync (internal/child_process.js:1041:20)
at spawnSync (child_process.js:616:24)
at Object.cancelAll (/home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/api/cupsApis.js:155:19)
at /home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/app.js:80:24
at Layer.handle [as handle_request] (/home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/node_modules/express/lib/router/layer.js:95:5)
at next (/home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/node_modules/express/lib/router/layer.js:95:5)
at /home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/home/finsoft/ProgettoStampantiLinux/ProgettoStampanti/node_modules/express/lib/router/index.js:335:12) {
errno: 'EACCES',
code: 'EACCES',
syscall: 'spawnSync /home/finsoft',
path: '/home/finsoft',
spawnargs: [ '-c', 'cancel -u' ]
},
status: null,
signal: null,
output: null,
pid: 9826,
stdout: null,
stderr: null
}
this is my spawnSync function:
cancelAll = function () {
let args = ["-a"];
let cancelAll = spawnSync("cancel", args, { encoding: "utf-8", shell: '/home/finsoft'});
// console.log(cancelAll);
return cancelAll;
};
the option shell:'/home/finsoft' is the path to the shell I want to use.
what I did until now:
1)I tried adding to the root group the user used in the spawnSync, which is finsoft, and i double checked it by running this:
let args = ["-u"];
args.push('finsoft');
let uid = spawnSync('id', args, { encoding: "utf-8"});
console.log(uid);
output of the console.log(uid):
{
status: 0,
signal: null,
output: [ null, '1000\n', '' ],
pid: 8141,
stdout: '1000\n',
stderr: ''
}
the witch correspond to the finsoft uid
2)i changed the permissions of /home/finsoft like this:
sudo chmod 777 /home/finsoft
the result of ls-l:
finsoft#finsoft-20351:/home$ ls -l
total 4
drwxrwxrwx 34 finsoft finsoft 4096 Feb 23 09:11 finsoft
I even tried to specify the option uid:0 in the spawnSync, it should use the root user, and changed the shell path to its default(/bin/sh), so i shouldn't have problems with permissions or other requirements stuff, but that gives a totally different error:
Error: spawnSync /bin/sh EPERM
What else can I try?

Gulp: Error: Unhandled “error” event. (1) when phpunit test fails

I am trying to autorun phpunit using gulp. When phpunit fails a test I see the following error in terminal (all passed tests do not cause the error):
FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
events.js:188
throw err;
^
Error: Unhandled "error" event. (1)
at Domain.emit (events.js:186:19)
at Stream.emit (events.js:181:14)
at Stream.onerror (/var/www/html/wptest2/node_modules/readable-stream/lib/_stream_readable.js:640:52)
at emitOne (events.js:116:13)
at Stream.emit (events.js:211:7)
at next (/var/www/html/wptest2/node_modules/map-stream/index.js:74:19)
at /var/www/html/wptest2/node_modules/map-stream/index.js:84:7
at /var/www/html/wptest2/node_modules/gulp-phpunit/index.js:341:17
at /var/www/html/wptest2/node_modules/shelljs/src/exec.js:204:9
at ChildProcess.exithandler (child_process.js:282:5)
Gulpfile.js:
var gulp = require('gulp'),
connect = require('gulp-connect-php'),
gulpPhpunit = require('gulp-phpunit');
gulp.task('gulpPhpunit', function(done) {
var options = {debug: false};
gulp.src('phpunit.xml')
.pipe(gulpPhpunit('./vendor/bin/phpunit', options));
done();
});
gulp.task("default", gulp.series('gulpPhpunit'));
Does anyone know how to solve this?

Categories