Starting hyperledger explorer fails - hyperledger-explorer

I have installed all prerequisites for setting up the hyperledger Explorer but when I start it, I got the following error in log file:
postgres://hppoc:password#127.0.0.1/fabricexplorer
fs.js:675
return binding.read(fd, buffer, offset, length, position);
^
Error: EISDIR: illegal operation on a directory, read
at Object.fs.readSync (fs.js:675:18)
at tryReadSync (fs.js:540:20)
at Object.fs.readFileSync (fs.js:583:19)
at configuration.getPeersByOrg.forEach.key (/home/ubuntu/blockchain-explorer/app/FabricClientProxy.js:164:20)
at Array.forEach (<anonymous>)
at FabricClientProxy.setupPeers (/home/ubuntu/blockchain-explorer/app/FabricClientProxy.js:161:36)
at configuration.getOrgs.forEach.key (/home/ubuntu/blockchain-explorer/app/FabricClientProxy.js:155:10)
at Array.forEach (<anonymous>)
at FabricClientProxy.createDefault (/home/ubuntu/blockchain-explorer/app/FabricClientProxy.js:137:27)
at new FabricClientProxy (/home/ubuntu/blockchain-explorer/app/FabricClientProxy.js:32:8)

As the error suggests, you have specified a directory instead of a file on which read operation is happening, I think somewhere in the config.json file you have given an incorrect path. Please check or post the config.json file so the issue can be identified.

Related

NodeJS not showing which file the actual error came from

I am running into an issue where there is an error in my app and all Node tells me is a line number from the dist copy of the app.
TypeError: Cannot convert undefined or null to object
at keys (<anonymous>)
at /Users/MyApp/dist/server.js:346:31
at Array.forEach (<anonymous>)
at /Users/MyApp/dist/server.js:336:46
at Generator.next (<anonymous>)
at step (/Users/MyApp/node_modules/babel-runtime/helpers/asyncToGenerator.js:17:30)
at /Users/MyApp/node_modules/babel-runtime/helpers/asyncToGenerator.js:28:13
at process._tickCallback (internal/process/next_tick.js:68:7)
so how do I know the actual line number and filename where the error was generated instead of pointing me to the dist version of the server.js file which is not very useful. I have a file called process.js and I am sure this is where the error is being generated but the logs don't tell me anything about this file.

Module build failed: TypeError: loader.charAt is not a function

I'm trying to run the npm run dev command, but I'm getting this message:
ERROR Failed to compile with 2 errors 21:31:43
Module build failed: TypeError: loader.charAt is not a function
at ensureBang (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:180:16)
at getLoaderString (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:145:18)
at getRequireString (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:80:7)
at getRequire (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:71:7)
at D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:205:11
at Array.forEach (<anonymous>)
at Object.module.exports (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:198:18)
Module build failed: TypeError: loader.charAt is not a function
at ensureBang (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:180:16)
at getLoaderString (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:145:18)
at getRequireString (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:80:7)
at getRequire (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:71:7)
at D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:205:11
at Array.forEach (<anonymous>)
at Object.module.exports (D:\iagof\Source\Repos\todo-list\node_modules\vue-loader\lib\loader.js:198:18)
You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
This problem appeared when I tried to reinstall all the modules. Anything, my project is on Github. Follow the repository link https://github.com/iagofrota/todo-list.

error: uncaughtException: require(...).invokeRolesPolicies is not a function

I am using MEAN.JS for developing a web app, but for some reason after I made few changes, well mostly copied and paste new modules into the app I see the error as below:
error: uncaughtException: require(...).invokeRolesPolicies is not a function
I dont know why is this happening, anyone has any clue how to fix this?
This is the whole error message:
TypeError: require(...).invokeRolesPolicies is not a function
at C:\oferdo\oferdo\config\lib\express.js:180:39
at Array.forEach (native)
at Object.module.exports.initModulesServerPolicies (C:\oferdo\oferdo\config\lib\express.js:179:32)
at Object.module.exports.init (C:\oferdo\oferdo\config\lib\express.js:252:8)
at C:\oferdo\oferdo\config\lib\app.js:29:23
at C:\oferdo\oferdo\config\lib\mongoose.js:36:15
at C:\oferdo\oferdo\node_modules\mongoose\lib\connection.js:284:19
at open (C:\oferdo\oferdo\node_modules\mongoose\lib\connection.js:511:17)
at C:\oferdo\oferdo\node_modules\mongoose\lib\connection.js:518:7
at C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\lib\db.js:1504:5
at handleCallback (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\lib\utils.js:96:12)
at _callback (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\lib\db.js:1420:5)
at C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\lib\db.js:1463:7
at C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:1416:5
at finish (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\auth\scram.js:157:16)
at handleEnd (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\auth\scram.js:170:7)
at C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\auth\scram.js:264:17
at commandCallback (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:1194:9)
at Callbacks.emit (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:119:3)
at null.messageHandler (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\topologies\server.js:358:23)
at Socket. (C:\oferdo\oferdo\node_modules\mongoose\node_modules\mongodb\node_modules\mongodb-core\lib\connection\connection.js:292:22)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:153:18)
at Socket.Readable.push (_stream_readable.js:111:10)
at TCP.onread (net.js:531:20)
Actually, this is nothing to do with incorrectly named files.
You need to make sure that you have the invokeRolesPolicies function defined within your policies file. The minimum required is:
'use strict';
var acl = require('acl');
acl = new acl(new acl.memoryBackend());
exports.invokeRolesPolicies = function () {};
The reason why is that the express.js lib defined in mean.js assumes this is set, and tries to call it, hence the error.
You'll get this error if you have an incorrectly named file under your module's server > policies directory, so check there for any inconsistently named files.
EDIT
I see now that it's not the naming of the file but if you have a file in the policies directory that doesn't contain this method, it will produce this error. In my case I had temporarily commented out the code in a file in this directory in preparation for removal.

SailsJs Invalid module error

After I installed lodash or async plug-ins,
Console shows those error messages when I launch sails.js.
but I don't know what cause those error messages.
I need to solve this problem. please anyone help me.
error: A hook (`userconfig`) failed to load!
error: Error: Invalid module:[object Object]
at /Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:83:15
at forOwn (/Users/johndo/github/sails/testProject/node_modules/lodash/dist/lodash.js:2105:15)
at Function.forEach (/Users/johndo/github/sails/testProject/node_modules/lodash/dist/lodash.js:3302:9)
at buildDictionary (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:74:4)
at Function.module.exports.aggregate (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:190:9)
at Array.loadOtherConfigFiles [as 0] (/Users/johndo/github/sails/testProject/node_modules/sails/lib/hooks/moduleloader/index.js:164:27)
at /Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:459:38
at Array.forEach (native)
at _each (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:32:24)
at Object.async.auto (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:430:9) [Error: Invalid module:[object Object]]
error: Error: Invalid module:[object Object]
at /Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:83:15
at forOwn (/Users/johndo/github/sails/testProject/node_modules/lodash/dist/lodash.js:2105:15)
at Function.forEach (/Users/johndo/github/sails/testProject/node_modules/lodash/dist/lodash.js:3302:9)
at buildDictionary (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:74:4)
at Function.module.exports.aggregate (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:190:9)
at Array.loadOtherConfigFiles [as 0] (/Users/johndo/github/sails/testProject/node_modules/sails/lib/hooks/moduleloader/index.js:164:27)
at /Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:459:38
at Array.forEach (native)
at _each (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:32:24)
at Object.async.auto (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:430:9) [Error: Invalid module:[object Object]]
It looks like it's experiencing an error while parsing your configuration files. Try rolling back your changes.
Also, lodash and async come as globals in sails, so you don't need to install them. Just go to config/globals and uncomment _(lodash). That might fix your problem, as maybe sails is having a conflict between its installed version and yours.

Error: ENOENT, no such file or directory 'data.json' when running `jsonplaceholder`

When I run jsonplaceholder I get:
jsonplaceholder
JSONPlaceholder listening on http://localhost:3000
fs.js:432
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT, no such file or directory 'data.json'
at Object.fs.openSync (fs.js:432:18)
at Object.fs.readFileSync (fs.js:286:15)
at Object.index.load (/usr/local/lib/node_modules/jsonplaceholder/node_modules/json-server/node_modules/lowdb/node_modules/underscore.db/src/node.js:11:24)
at Function.low.load (/usr/local/lib/node_modules/jsonplaceholder/node_modules/json-server/node_modules/lowdb/lib/index.js:110:29)
at reset (/usr/local/lib/node_modules/jsonplaceholder/index.js:6:14)
at Server.<anonymous> (/usr/local/lib/node_modules/jsonplaceholder/index.js:14:3)
at Server.g (events.js:180:16)
at Server.EventEmitter.emit (events.js:92:17)
at net.js:1052:10
at process._tickCallback (node.js:415:13)
Im on Ubuntu 13.10
Project's author here. Just to let you know, finally, this (old) bug was fixed. Sorry for the inconvenience caused.
I'm still not sure if this has anything to do with an outdated module, or a messed up npm installation or maybe I'm just lucky, but basically the problem is that the path to access "data.json" is wrong (maybe not wrong but incomplete).
What I did was open file:
gksudo gedit /usr/local/lib/node_modules/jsonplaceholder/index.js
and modify the following function:
function reset() {
// server.low.load('data.json') <-- ORIGINAL LINE
server.low.load(require('path').resolve(__dirname, 'data.json')); //<--MY FIX
}
Just save the file, and run jsonplaceholder again.

Resources