Can't manage to sign a transaction

Hello,
I am a newbie in Ethereum and Javascript. My box is an up to date Linux Xubuntu (14.04 LTS)
I installed nodejs and npm (apt-get install....). Then I installed ethereumjs-tx with npm.
No problem at all (apparently !). All dependencies seem to be correctly installed.
I copy/paste the demo code of transaction sign present on the md github page of ethereumjs-tx.

The I run the code in nodejs.

I get this error message :

/home/geekbot/node_modules/ethereumjs-tx/index.js:185
Object.assign(this, sig)
^
TypeError: Object function Object() { [native code] } has no method 'assign'
at Transaction.sign (/home/geekbot/node_modules/ethereumjs-tx/index.js:185:10)
at Object. (/home/geekbot/Development/Nodejs/TxBuilder/txBuilder.js:14:4)
at Module._compile (module.js:456:26)
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 Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3

I guess it's an installation problem, but I can't find out the root cause of the issue.
Any clue is welcome
Thanks a lot
GeekBot

Comments

  • GeekBotGeekBot Member Posts: 6
    Hello,
    Following the idea of a bad installation of nodejs and/or npm I removed all the ubuntu packages (nodejs, nmp, nodejs-legacy) with apt-get autoremove nodejs npm nodejs-legacy and cleaned up all the accompanying directories.

    Then I downloaded the nodjs tgz package from the nodejs site (LTS version)
    Decompress the tar.gz in a "local directory"
    Set linux PATH to the bin folder present in the "local directory"
    Set NODE_PATH environment variable to the bin folder present in the "local directory"
    execute : npm install git+https://github.com/ethereumjs/ethereumjs-tx.git
    You can run js programs.
    The code example give on the md page works.

    As a conclusion, the Ubuntu install doesn't work, and the manual install works.
    HTH
    GeekBot
  • noxonnoxon Member Posts: 2
    edited June 2016
    Got same problem. yes need node.js v4.*

    apt-get autoremove nodejs npm nodejs-legacy
    wget https://nodejs.org/dist/v4.4.5/node-v4.4.5.tar.gz
    tar xf node-v4.4.5.tar.gz
    cd node-v4.4.5
    ./configure
    make -jX
    make install
    node -v
  • toothalicioustoothalicious Member Posts: 37
    I'm sure no one will have this problem at this point but its as noxon has said... Object.assign is an ecmascript 6 specification... one that was not implemented until at least version 4 of NodeJs so you need at least node v4
Sign In or Register to comment.