I want to create a new account via code (Node.js), so I ran the following code, which was copy-pasted from the docs:


How ever accounts' value is an empty array, and therefore I'm getting this error:

web3.eth.accounts.create is not a function

which makes sense because Array doesn't have a method named create.

How do I create a new account?


I think you are using web3 version prior to 1.0. as i know web3.eth.accounts.create() was introduced in web3 1.0. so check your web3js version. if you have a prior version use web3.eth.personal.newAccount(password, [callback]) documented here

  • For some reason npm installs version 0.20.2 by default. In that version the right command is neither of the above but: web3.personal.newAccount(password, [callback]). What a DLL hell! What would you recommend me to do? Use my current version or upgrade to 1.0 (if it's possible at all)
    – Alon
    Nov 9 '17 at 16:17
  • try npm install web3@1.0.0-beta.24
    – Badr Bellaj
    Nov 9 '17 at 16:32
  • it throws stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
    – Alon
    Nov 9 '17 at 16:53
  • this is a nodejs issue stackoverflow.com/questions/21365714/…
    – Badr Bellaj
    Nov 9 '17 at 17:38

separate the "password" and "callback result" arguments of each other


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.