Creating new account from web3 showing error

5 days ago

while creating new account from angular using web3

personal.newAccount function() undefined

import {

Injectable } from


import {

User } from


const Web3=require('web3');

declare let

require: any;

declare let

window: any;

let tokenAbi =



export class

ContractService {

private contAbi=require('./tokenContract.json');

private contAddr='0xadd2b6f750e0a05b25840ac9037365ce79f6a475';


private contract:any;

constructor() {

if (typeof

this.web3 !==

'undefined') {

this.web3 =

new Web3(this.web3.currentProvider);

} else {

this.web3 =

new Web3(new





accs) => {

if (err !=

null) {

alert('There was an error fetching your accounts.');



if (accs.length ===

0) {

alert('Couldn\'t get any accounts! Make sure your Ethereum client is configured c

  • Your web3 talks to a node over RPC. If it is a geth node, the personal api is not exposed/enabled by default for security reasons.

    Exercise caution.

    You might enable it with geth --rpcapi eth,web3,personal in addition to your other parameters.

    Hope it helps.

    5 days ago