Hyperledger enrollment error (node enrollAdmin.js): SyntaxError: Unexpected token - hyperledger-fabric

I'm a novice attempting to write my 1st hyperledger app.
I am following the instructions at https://hyperledger-fabric.readthedocs.io/en/release-1.2/write_first_app.html.
all appears to be working fine until I get to this:
$ node enrollAdmin.js:
/home/mark/fabric-samples/fabcar/node_modules/fabric-client/lib/Client.js:230
 getChannel(name, throwError = true) {
SyntaxError: Unexpected token =
 at exports.runInThisContext (vm.js:53:16)
 at Module._compile (module.js:374:25)
 at Object.Module._extensions..js (module.js:417:10)
 at Module.load (module.js:344:32)
 at Function.Module._load (module.js:301:12)
 at Module.require (module.js:354:17)
 at require (internal/module.js:12:17)
 at Object. (/home/mark/fabric-samples/fabcar/node_modules/fabric-client/index.js:25:18)
 at Module._compile (module.js:410:26)
 at Object.Module._extensions..js (module.js:417:10)

Related

GLIBC_2.25 not found when tyring using argon2 in nodejs

this is the response i got when i run node file
`node:internal/modules/cjs/loader:1210
return process.dlopen(module, path.toNamespacedPath(filename));
^
Error: /lib64/libc.so.6: version GLIBC_2.25' not found (required by /home/mhmd8/nodevenv/dad.online/16/lib/node_modules/argon2/lib/binding/napi-v3/argon2.node) at Object.Module._extensions..node (node:internal/modules/cjs/loader:1210:18) at Module.load (node:internal/modules/cjs/loader:1004:32) at Function.Module._load (node:internal/modules/cjs/loader:839:12) at Module.require (node:internal/modules/cjs/loader:1028:19) at require (node:internal/modules/cjs/helpers:102:18) at Object.<anonymous> (/home/muhamad8/nodevenv/resumeku.online/16/lib/node_modules/argon2/argon2.js:9:25) at Module._compile (node:internal/modules/cjs/loader:1126:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10) at Module.load (node:internal/modules/cjs/loader:1004:32) at Function.Module._load (node:internal/modules/cjs/loader:839:12) { code: 'ERR_DLOPEN_FAILED' }
how i can solve this problem, thanks!

Algorithm should be set

I'm working on a Cypress project that was working fine.
But recently, it started throwing some errors. I searched for reasons as to why I was getting the errors. I found out that in my index.js file the export.module had a line to throw an error if the option algorithm was not set as below.
My question is where should I set the said algorithms and how?
Here's the git repository of the project
https://github.com/Leealp/BugsFixed2
module.exports = function(options) {
....................................................................
if (!options.algorithms) throw new Error('algorithms should be set');
var secretCallback = options.secret;
if (!isFunction(secretCallback)){
secretCallback = wrapStaticSecretInCallback(secretCallback);
}
....................
....................
}
The error is below:
C:\Users\AlphaLy\Documents\Coding\Cypress Web Automation upload\CypressLastPractices\node-express-sequelize-nextjs(L)\node_modules\express-jwt\lib\index.js:22
if (!options.algorithms) throw new Error('algorithms should be set');
^
Error: algorithms should be set
at module.exports (C:\Users\AlphaLy\Documents\Coding\Cypress Web Automation upload\CypressLastPractices\node-express-sequelize-nextjs(L)\node_modules\express-jwt\lib\index.js:22:34)
at Object.<anonymous> (C:\Users\AlphaLy\Documents\Coding\Cypress Web Automation upload\CypressLastPractices\node-express-sequelize-nextjs(L)\auth.js:20:13)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\AlphaLy\Documents\Coding\Cypress Web Automation upload\CypressLastPractices\node-express-sequelize-nextjs(L)\api\users.js:3:14)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\AlphaLy\Documents\Coding\Cypress Web Automation upload\CypressLastPractices\node-express-sequelize-nextjs(L)\api\index.js:8:17)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\AlphaLy\Documents\Coding\Cypress Web Automation upload\CypressLastPractices\node-express-sequelize-nextjs(L)\app.js:17:13)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
PS C:\Users\AlphaLy\Documents\Coding\Cypress Web Automation upload\CypressLastPractices\node-express-sequelize-nextjs(L)>

nodejs: curly brackets in require statement throwing error

when I try to start app "sudo start app.js", it throws exception
const {notFoundRouteError} = require('../errors');
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/project-path/server/index.js:4:25)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
Also downgraded node version to v6.11.0 but it still doesn't work
Also try let instead of const like this,
But, you need to enforce the strict mode.
"use strict"
let {notFoundRouteError} = require('../errors');
Hope this helps!

Can we call a function or a variable from specs file to protractor config file?

I have a declaration of a variable in my spec file(app.Login.ts), lets say
[Let comment = 'hello']
and now this variable (comment), i need to use in my protractor.config.js file. When I'm trying
using import { comment } from './e2e/app.Login';
i'm getting error saying
import { comment } from './e2e/app.Login';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at ConfigParser.addFileConfig (C:\Users\M220101\AppData\Roaming\npm\node_modules\protractor\built\configParser.js:135:26)
How to resolve it?

Node App - ReferenceError: uriUtil is not defined

I was workign on a Node App a few weeks ago which worked fine. I went to restart it today and its throwing this error
var mongooseUri = uriUtil.formatMongoose(mongodbUri);
^
ReferenceError: uriUtil is not defined
at Object.<anonymous> (d:\A\B\C\Web Applications\Donations1\routes\donations.js:14:19)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (d:\A\B\C\Web Applications\Donations1\app.js:9:17)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:139:18)
at node.js:999:3
It relates to this line of code that connects to mongodb
var mongodbUri = 'mongodb://AAA:BBB#ds053305.mongolab.com:12345/donations';
var mongooseUri = uriUtil.formatMongoose(mongodbUri);
You can replace this line:
var mongooseUri = uriUtil.formatMongoose(mongodbUri);
Which this line:
var mongooseUri =require('mongodb-uri').formatMongoose(mongodbUri);
Don't worry to require same module more than once. Node always require only one time, and after that use the cache for loading the module.

Resources