I've installed Truffle by npm, and running testrpc, but console.log is not working in Truffle console. A simple console.log('test'); do nothing. Any idea?

  • which truffle version are you using, which testrpc version are you using, what's your operating system, can you provide sample code? Commented Jan 7, 2018 at 7:38

2 Answers 2


I don't have a complete answer, but I believe it has to do with the console's automatic resolution of javascript promises. For example,

Contract.deployed().then(instance => instance.contract)

the truffle console will actually wait for the final .then promise to resolve and will then print instance.contract. That said, I would imagine that

new Promise(() => console.log('test'))

would work, or even

new Promise(() => 'test')

but they don't for me. I don't know enough about promises or the truffle console to understand why that doesn't work. Hopefully this gets fixed in the future. For now, you can do

Contract.deployed().then(() => console.log('test'))


Contract.deployed().then(() => 'test')

as workarounds.


in the Testing Your Contracts

Please try it if your file location is /test/contract.js

$ truffle test ./test/contract.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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