the javascript file used to communicate with test-net :
$(document).ready(function(){
if (typeof web3 !== 'undefined'){
console.log('Web3 found');
web3 = new Web3(web3.currentProvider);
} else {
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
}
$("#creatAccountSubmit").click(function(){
var count = $("#noOfAccount").val();
for (let index = 0; index < count; index++) {
var accounts = web3.eth.accounts.create();
console.log(accounts);
}
});
});
I am using ganache-cli as a local provider I don't know which web3 version it uses but the package.json file in my project folder seems to use 1.0.0
{
"name": "project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"web3": "^1.0.0-beta.30"
}
}
but after running the web page to create an account am getting an error
"TypeError: web3.eth.accounts.create is not a function"
but the node consoles (it uses web3-1.0.0) I can run the same command, How can I resolve this error, I think changing the web3 version used by ganache-cli will do the task but don't know how to do it?
web3.eth.personal.newAccount()
?