2
votes

I'm following this tutorial. After using the command truffle migrate --reset the blocks appear on Ganache GUI. However, I'm not able to interact with the contract using the console. If I type token = await MemoryToken.deployed(), I receive the following error:

truffle(development)> let token = await MemoryToken.deployed()
Uncaught ReferenceError: global is not defined at evalmachine.<anonymous>:2:19

I have no idea why. I tried this several time with the same result. What am I missing ?

The same happens with the tutorial from the truffle website.

4
Great question. Just started experiencing this as well. I can test it via truffle test, but can't interact with it via truffle console (after I manually migrate). Same error. - iolympian
downgrade the truffle version to 5.4.3 - ovo
@ovo It works thank you very much. Do you have any idea why this happen with truffle v5.4.5 ? - Caladay

4 Answers

2
votes

A temporary workaround is to explicitly define global in the REPL:

global = this
0
votes

Try

truffle(development)> let token = MemoryToken.deployed()

It worked for me. I don't know much more about the error

0
votes

I had same issue. Changed node version from v12.22.4 to v10.16.0.

0
votes

I had the same problem in the MetaCoin example with Truffle v5.4.5 (core: 5.4.5), Solidity v0.5.16 (solc-js), Node v14.14.0, Web3.js v1.5.1. It works after downgrading Truffle to version v5.4.3 as suggested by @ovo.