Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Truffle Uncaught ReferenceError: global is not defined after using migrate

Tags:

truffle

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.

like image 754
Asamartino Avatar asked Sep 12 '25 01:09

Asamartino


1 Answers

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

global = this
like image 59
Muhammad Shuja Avatar answered Sep 13 '25 14:09

Muhammad Shuja