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

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.

Related

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;

Modify Kibana Source Code for Pie Charts

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

Node.js: Error: Cannot find module 'stack'

I tried to install howtonode.org on my Osx
cd ~/Sites/
git clone git#github.com:creationix/howtonode.org
My context is the following:
OSx version: 10.7.4
node -v v0.6.15
When I try to run the following command
~/Sites/howtonode.org node server/server.js &
I get the following error:
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'stack'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/Users/antoniopierro/Sites/howtonode.org/server/server.js:2:13)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
[1]+ Exit 1 node server/server.js
any ideas?
Try running node ~/Sites/howtonode.org/server/server.js & or go to ~/Sites/howtonode.org/server/ and runnode server
Also, you have not installed the dependencies from package.json.
Go to ~/Sites/howtonode.org/ and type inn npm install. This will install all the dependencies in ~/Sites/howtonode.org/node_modules. You can then run the server.

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