Modify Kibana Source Code for Pie Charts - elasticsearch

We are Exploring possibilities to extend and modify Kibana. I am trying to customize the existing Pie Chart functionality by forking kibana and then adding some consoles and eventually add customizations in Pie_chart.js in src/cli/public/vislib/visualizations. When I do ./kibana from bin in my local branch of kibana it gives me an error
/Users/schhatre/kibanSourceRepo/kibana/src/optimize/babel_options.js:4
let cloneDeep = require('lodash').cloneDeep;
^^^^^^^^^
SyntaxError: Unexpected identifier
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/schhatre/kibanSourceRepo/kibana/src/cli/index.js:3:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
My forked Kibana is https://github.com/schhatre/kibana. I also removed 'Use Strict' since it was giving me Keyword 'Word' errors earlier when I run ./kibana
Eventually I would like to start kibana by modifying kibana.yml with my IP and see my consoles and eventually move on to customize the Pie Charts.
I was successfully able to start Kibana and implement some plugins (Since plugins can be added in src/plugins and don't need Kibana Source code Changes) from downloaded zip but not from the github forked/cloned master branch's bin location.
Any help would be appreciated.I even went to an older 4.4 Version our company is on and tried to run ./kiban from /bin. Still no luck..
Swaraj

It seems that your NodeJs version does not support ES2015 syntax. Make sure that you are using the proper version. To get the required NodeJs version:
cat .node-version
(your version is 4.4.4 on your repository)
Install this version with NVM (install NVM first if you don't have it):
nvm install v4.4.4
Use the version you just installed :
nvm use v4.4.4
Start Kibana:
npm start

Related

Getting error when trying to run Ganache (forking BSC chain)

I have installed Ganache following instructions from https://github.com/trufflesuite/ganache#documentation
I am trying to fork BSC chain for which I have a node running locally which is fully synced (I want to fork this for which I have provided the URL in package.json under scripts).
When trying to run Ganache using npm run ganache it is giving me this error. Any idea how can I solve this?
SyntaxError: Unexpected token '?'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Module.require (internal/modules/cjs/loader.js:887:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.__webpack_require__.f.require (/usr/local/lib/node_modules/ganache/dist/node/cli.js:2:21481)
at /usr/local/lib/node_modules/ganache/dist/node/cli.js:2:20777
at Array.reduce (<anonymous>)`
Supposedly it was supposed to run after this, so why i am getting this error?
Check your Node.js version:
node -v
v18.13.0
Version must be >= v14.0.0. After updating to the latest Node.js version, the error no longer occurred for me.

Keystone.js app startup fails on Heroku due to missing importer?

My Keystone.js 4 project using Node 10.15 is failing to start on Heroku:
Error: Cannot find module './lib/core/importer'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/app/node_modules/keystone/index.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
Process exited with status 1
State changed from crashed to starting
Starting process with command `node ./dist/keystone.js`
State changed from starting to crashed
Process exited with status 1
internal/modules/cjs/loader.js:583
throw err;
I have other Keystone applications configured in exactly the same way that run correctly.
I have tried disabling the build cache, creating a new application instance to deploy to and have verified through the Heroku console that the file in question does exist in the source.
The project builds and runs correctly in Windows 10 and *nix environments locally.
What can I do to debug this?
So it seems the problem is due to npm 6.5.x not installing all of Keystone's dependencies. Switching to Yarn as the package manager fixes this.
I installed the latest version of Yarn, 1.13.0 as of now.
Installed dependencies via yarn
Committed the yarn.lock file
Specified "yarn": "1.13.0" in the "engines" section of my package.json and removed "npm" from the engines.
Re-deployed to Heroku and it works as expected.
Hope this helps someone!

Assertion Error while compiling Solidity code in Ethereum

H:\Ethereum\Kickstarter\ethereum>node compile.js
H:\Ethereum\Kickstarter\node_modules\solc\soljson.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath"normalize";var ret=nodeFS"readFileSync";if(!ret
AssertionError [ERR_ASSERTION]: Invalid callback specified.
at wrapCallback (H:\Ethereum\Kickstarter\node_modules\solc\wrapper.js:16:5)
at runWithReadCallback (H:\Ethereum\Kickstarter\node_modules\solc\wrapper.js:37:42)
at compileStandard (H:\Ethereum\Kickstarter\node_modules\solc\wrapper.js:78:14)
at Object.compileStandardWrapper (H:\Ethereum\Kickstarter\node_modules\solc\wrapper.js:85:14)
at Object. (H:\Ethereum\Kickstarter\ethereum\compile.js:19:21)
at Module._compile (module.js:652:30)
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)
The following would get the latest stable version of the Solidity Compiler:
npm install --save solc
For me the issue was with this version. I downgraded solc using the following command to an older version (after removing the currently installed version).
npm install --save solc#0.4.17
This resolved the issue. Furthermore, I changed the first line of my smart contract in my contracts directory to:
pragma solidity ^0.4.17;
run following command, as suggested by Divyanshu
npm install --save solc#0.4.17
and verify that the first line of your contract is
pragma solidity ^0.4.17;

composer rest server fails to start after upgrade to composer 0.19.6

docker logs -f rest shows the following
[2018-05-28 06:38:39] PM2 log: Launching in no daemon mode
[2018-05-28 06:38:39] PM2 log: Starting execution sequence in -fork mode- for app name:composer-rest-server id:0
[2018-05-28 06:38:39] PM2 log: App name:composer-rest-server id:0 online
{ Error: Cannot find module 'base64-js'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:7:11309)
at t (/home/composer/node_modules/swagger-client/dist/index.js:1:177)
at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:7:7)
at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:7:11111)
at t (/home/composer/node_modules/swagger-client/dist/index.js:1:177)
at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:1:48717)
at t (/home/composer/node_modules/swagger-client/dist/index.js:1:177)
at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:1:40420)
at t (/home/composer/node_modules/swagger-client/dist/index.js:1:177)
at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:1:16408)
at t (/home/composer/node_modules/swagger-client/dist/index.js:1:177)
at Object.<anonymous> (/home/composer/node_modules/swagger-client/dist/index.js:1:15877) code: 'MODULE_NOT_FOUND' }
[2018-05-28 06:38:41] PM2 log: App [composer-rest-server] with id [0] and pid [14], exited with code [1] via signal [SIGINT]
I installed base64-js via npm but still get the same error
Following on from the previous answer and comments:
There has been a problem last week building the Docker Images for Composer, so the version with the "latest" tag is v0.19.5.
If you look at this page on Docker Hub you can see the problem:
https://hub.docker.com/r/hyperledger/composer-rest-server/tags/
As a temporary measure, if you run these 2 docker commands you should get a v0.19.6 version of the image that will be compatible with your v0.19.6 installed modules.
docker pull hyperledger/composer-rest-server:0.19.6-20180524041020
docker tag hyperledger/composer-rest-server:0.19.6-20180524041020 hyperledger/composer-rest-server:latest
I would suggest using docker rmi to remove any existing composer-rest-server images before using the commands above.
UPDATE After Later Comments - AND Appology
I'm sorry - I thought this would work and that these versions would be compatible.
To get compatibility now, you could re-install everything to v0.19.5 and use the 'trick' above to pull a composer-rest-server v0.19.5 and rename to latest (having removed the earlier one first)
or
you could uninstall composer and install the date specific version to be compatible with the container version. (you will need to restart fabric and re-deploy the network again.) e.g. npm install -g composer-cli#0.19.6-20180524041020
I have not tested this!
see https://github.com/hyperledger/composer/issues/4067
A bad swagger-client npm module was published 3 days ago which caused the problem. A new version of swagger-client 3.8.6 has now been published to fix the problem.

CoffeeScript and Cake

I installed CoffeeScript on my machine with npm install -g coffee-script I get the following message when I check cake version:
$ coffee -v
CoffeeScript version 1.3.3
[~]
$ cake -v
path.existsSync is now called `fs.existsSync`.
/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/cake.js:108
throw new Error("Cakefile not found in " + (process.cwd()));
^
Error: Cakefile not found in /Users/Phil
at cakefileDirectory (/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/cake.js:108:11)
at cakefileDirectory (/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/cake.js:106:14)
at cakefileDirectory (/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/cake.js:106:14)
at Object.exports.run (/usr/local/share/npm/lib/node_modules/coffee-script/lib/coffee-script/cake.js:49:19)
at Object.<anonymous> (/usr/local/share/npm/lib/node_modules/coffee-script/bin/cake:7:38)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:492:10)
Does anyone know how can I fix this?
There are two issues here.
The first is a known issue which causes:
path.existsSync is now called `fs.existsSync`
You can find out more about the issue here:
https://github.com/jashkenas/coffee-script/pull/2411
As stated in the pull request, it should be fixed in the coffee-script master branch. So you can download the latest source from GitHub and it should resolve the issue for you.
Otherwise, try installing an older version of node:
http://nodejs.org/dist/v0.6.6/
The second issue which is addressed in other answers, is the need for a Cakefile in the directory that you are running the cake command in.
Cakefile should be exists in directory where you call cake
I had similar issue in cakephp3. Above solution didn't work. I was trying to bake plugin from the command line.
cake bake Plugin PageManager
After receiving above error, I changed my command to following and it worked like a charm .
./cake bake plugin PageManager
Hope it will help to someone who had similar issues as mine.

Resources