LoginSignup
2
2

More than 5 years have passed since last update.

Truffleが「Deploying Migrations...」で止まる場合の対策

Last updated at Posted at 2018-03-03

Truffleでデプロイする際、 Deploying Migrations... の表示で止まってしまい先に進まなくなる場合があります。エラーも表示されません。

$ truffle deploy --network development
Using network 'development'.

Running migration: 1_initial_migration.js
  Deploying Migrations...


いくら待っても何も起きない。

原因

  • 指定したアカウントがロック解除されていない
  • そもそもアカウントを指定してない

指定したアカウントがロック解除されていないの対策

アカウントのロックを解除します。

truffleから作業

web3.personal.unlockAccount はgethの独自実装のためparityで利用する場合は --geth オプションを付加してgeth互換モードで利用する必要あり。

$ truffle console --network development
truffle(development)> web3.personal.unlockAccount("0x7ad8f90cfa071c8420e3f09fe0e413d0c47502e6", 'YOURPASSWORDHERE')

geth互換モードを利用しないparityに対して上記関数をコールすると以下のようなエラーが出ます。

Error: Method not found
    at Personal.send [as unlockAccount] (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/method.js:145:1)
    at RequestManager.send (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:61:1)
    at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/errors.js:38:1)

Parity起動時にunlockする場合

起動オプションに--unlockを追加して対象アカウントを指定。

parity --config node0.toml --unlock 0x7ad8f90cfa071c8420e3f09fe0e413d0c47502e6

そもそもアカウントを指定してない場合の対策

アカウントを明示します。
truffleはデフォルトでcoinbaseを使用する(?)ようですが、truffle.jsfromで明示することも可能です。

...
    },
    development: {
      host: "10.1.0.8",
      port: 8545,
      network_id: "*",
      from: '0x7ad8f90cfa071c8420e3f09fe0e413d0c47502e6'
    },
    test: {
...

備考

  • 以下の環境で再現
    • Parity: 1.9.4
    • Truffle: 4.1.0
  • Parityで発生したがGethでも発生するかも?
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2