Truffle Introduction

Hi filip
I was able to successfully compile everything, when you did the HelloWorld version 0.5.12 last year. No issues at all. I went back again using different version. Here is what I did. I downloaded ganache v2.5.2, uninstalled old truffle version and I did only npm install -g truffle.
I entered the source code in Atom below but using pragma solidity 0.7.5;
Also I changed truffle-config.js’s version: “0.7.5”
Now when I issued the truffle compile from the terminal, I got this error:

TypeError: Cannot read property ‘imports’ of undefined
at Object. (C:\Users\jojop\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\compile-common\dist\src\profiler\requiredSources.js:98:1)
at ()
at fulfilled (C:\Users\jojop\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\compile-common\dist\src\profiler\requiredSources.js:5:42)
Truffle v5.1.66 (core: 5.1.66)
Node v12.18.2
Any help would be greatly appreciated.

I was able to solve it. I changed everything to 0.7.4 including the migration.
I opened it using Visual Studio instead of Atom. VS will give you a clue on what the issue is.

Can you check your Migrations.sol? Try to change it to 0.5.12 as well.
I have the same problem but Im using 0.7.4.
I matched them all after changing the truffle-config.js

I started using VS Code but when I compiled it, Ganache did not accept it. Also, it created a bin file. I think on Philips video, a different type of folder is created…?

I could not get Cmder to load Truffle, did it work on your end?

Hey @padlanau

Regarding this error TypeError: Cannot read property ‘imports’ of undefined follow this FAQ:

Let me know,

1 Like

Thanks @dan-i this one works for me :slight_smile:

1 Like

I found some error message after I send the console message like this

truffle(ganache)> instance.getMessage()

Uncaught ReferenceError: instance is not defined
    at evalmachine.<anonymous>:0:1
    at sigintHandlersWrap (vm.js:272:15)
    at Script.runInContext (vm.js:127:14)
    at runScript (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/console.js:213:1)
    at Console.interpret (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/console.js:228:1)
    at ReplManager.interpret (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/repl.js:123:1)
    at bound (domain.js:427:14)
    at REPLServer.runBound [as eval] (domain.js:440:12)
    at REPLServer.onLine (repl.js:760:10)
    at REPLServer.emit (events.js:315:20)

but the await HelloWorld.deployed() successful to compile

I found what my mistake I don’t declare new variable to call the await function.

can fixed it by use this command

let instance = await HelloWorld.deployed()
1 Like

Hello All,

At the video with title “Setter Function” at minute 2:28, when executing the command:
let instance = await Helloworld.deployed()

you may get an error like (if you already declared the instance variable before):

let instance = global.__await_outside_result; void delete global.__await_outside_result;

Uncaught SyntaxError: Identifier 'instance' has already been declared

in this case just repeat the same command without the let.

Have fun,

Edit: I just saw that @filip talks about it in minute 6:02.
I run into that problem because I had already initialised the `instance`` variable from the previous video.

1 Like

i wasn’t able to install truffle with the power shell or cmder
can some one help me out

Hi @beloved

Can you elaborate your question and include the error message and a screenshot of your power shell?


here wat occur in my window powershell when I try to install truffle

If you want to install a pkg globally, you should try to open PowerShell as administrator.
Keep me posted.

Hello @filip,

Why do I keep getting this message when I try to migrate from the Truffle console, but not from the Terminal? I also get the same message when I try to run test command for unit test from the Truffle console and then nothing happens. Mt Truffle configuration file is the same as yours. I clone your repo from GitHub so the code is exactly the same as yours, but I cannot successfully complete the exercises from the Truffle console because of this.

Unknown network "ganache". See your Truffle configuration file for available networks.

after i run mine as administrator this wat saw

I found the solution to this problem. It seems like I had to explicitly define a network named ganache in the truffle-config.js file. In my case, as follows:

ganache: {
      host: "",   
      port: 7545,           
      network_id: "5777",       

Hi @beloved

You seem to be in the system 32 folder, change directory and navigate into the root directory of your project and run npm install -g [email protected]


Having the same problem here @filip. @Kim_model did you find a solution? The trick @Nile mentioned did not work for me. Even restarting ganache and power shell and deploying a-fresh did not work. It even got worse and the getMessage function previously recognized will now also throw this error:

truffle(ganache)> instance.getMessage()

Uncaught TypeError: instance.getMessage is not a function
at evalmachine.:0:10
at sigintHandlersWrap (vm.js:273:12)
at Script.runInContext (vm.js:140:14)
at runScript (C:\Users\sound\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\console.js:213:1)
at Console.interpret (C:\Users\sound\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\console.js:228:1)
at ReplManager.interpret (C:\Users\sound\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\repl.js:123:1)
at bound (domain.js:413:15)
at REPLServer.runBound [as eval] (domain.js:424:12)
at REPLServer.onLine (repl.js:817:10)
at REPLServer.emit (events.js:315:20)

EDIT: also this shows up when only calling the instance to see all functions of the contract

truffle(ganache)> instance2
[Function: bound deployed] AsyncFunction


I could make it run somehow, I am not sure though why it works out now. After defining the 4th Instance of the contract it worked out suddenly.

Made me remember why I took a break from Coding and Computers many years ago, lol


For anyone struggling with this:
Try to create a new instance after you deploy/migrate again, this does the trick for me. Anyhow, truffle migrate --reset does only work for me, if I also create a new instance. another way is to exit the truffle console with .exit and restarting it, as this will clear all instances. Then, to make sure, migrate again with migrate --reset, set your new instance with let instance = await contractname.deployed()

Hope this helps