Truffle Introduction

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]

Cheers,
Dani

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()
evalmachine.:0
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)
truffle(ganache)>

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

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

UPDATE:

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

UPDATE 2:

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

@filip in the ErrorHandling video you say that the migration will catch an error because we do not meet the require statement, because we are not sending in 1 ETH but a million wei. I am a little confused because I can migrate --reset it without an error and console.log(“Success”) will call.

Why is that? What did I miss?

how pls can u email me the procedure

Hi @Bhujanga

If you are able to deploy it means that the require statement pass successfully, it would revert otherwise :slight_smile:
Please post both your migration file and your contract.

Cheers,
Dani

Hey @beloved

I searched on YouTube for you and I found a really easy video that explains how to use cd.
Check it out: https://www.youtube.com/watch?v=BfXh11ryBJg

Cheers,
Dani

@dan-i Thank you for your reply. I found out what was different in my contract to Filip’s. I just missed that he inserted a require statement in the function. So it would throw no error with my contract, as there was no require function.

1 Like

it didnt work still say the same thing

Can you provide a screenshot of the powershell window?

IT JUST WORKED

Indeed you are not installing in system 32 anymore :slight_smile:

Happy studying !
Dani

Hello everyone, I am having an issue when I add my “truffle-config” to ganache. I am able to add it to ganache, but once added all my account address have a balance of 0ETH; So obviously the contract won’t allow me to compile the project… Thanks for the help!!!

Hi @Tumbleur

Try the following and let me know:

  • Open Ganache and select new workspace
    Screenshot 2021-02-26 at 22.22.35

  • Click on Accounts & keys and make sure that the value indicated in account default balance is > than 0.

  • Select now you truffle-config file and click on save workspace.

Keep me posted,
Dani

1 Like

I am rewatching the truffle Setter Function video. How would I input a value for the deposit function?
I tried instance.deposit({value: 1000000000000000000}) but it won’t update the balance. The transaction goes through, but is not updating the balance…

Hey @dan-i !
You are my Hero of the day !
Thanks a lot for the help, have a great week-end!
Kilian

1 Like

You are welcome!

Wish you a nice weekend too

1 Like

I had so many problems with this course and decided to take a break and complete the new version of Smart Contract 1.0. I’m done with that now. So now I started this course over again. I’m following Filip’s instructions step-by-step through the video and cannot get pass the setter video course.

I inserted the setMessage function into the Helloworld.sol file as Filip instructed. Then, I entered:
let instance = await Helloworld.deployed()
But the screen states that instance has already been declared.

Very frustrated with this course!

If we have to use metamask to do this course, I’m quitting. I used metamask once before this course and my experience with it was awful. I tried to buy some altcoins and found that the transaction fee was nearly $300. I didn’t want to pay that of course, so I tried to pull my money out of metamask, but there was a display error that showed that all my funds had disappeared! I was very stressed about that of course, and stayed up late into the night to try to fix it. I eventually got my money back by uninstalling and reinstalling metamask. The rest of my week was awful because metamask had caused me to lose sleep on the weekend and I wasn’t able to catch up on sleep until the next weekend. I was so tired that I was clumsy one morning and smashed my face into a table in the dark and broke a tooth. I know metamask isn’t directly responsible for making me lose my tooth, but it still left a strong impression on me. I will never use metamask again.

Hey @MrSeven

This is a javascript error.
In all programming languages, you cannot declare the same variable twice, however you can assign a new value to a variable already declared :slight_smile:

You cannot do:

let instance = 10;
let instance = 20;

You can do:

let instance = 10;
instance = 20;

The compiler is telling you that instance has already been declared, therefore you have to assign a new value to it.

Happy learning,
Dani