Truffle Introduction

That`s a great hint @gabba, thanks a lot!

Will experiment with this.

Amy,
your question and screenshot helped me install truffle on my MacBooc , Thank you!!

2 Likes

@filip or @gabba
Something is not right with my Truffle installation on MacBook Pro. Please help?

1 Like

Hi Dora.
The truffle init has to be done in the project folder.

It looks like you have done ‘truffle init’ in the Documents folder. Then you try to go to the ethereum-course-advanced.?
It looks like you try to enter the Helloworld folder, but that it cant find it. Can you confirm that you have created the Helloword folder?

You can try to do this:

  1. In the ‘ethereum-course-advanced’ folder, create a new folder called ‘Helloworld’.

  2. when inside the ‘Helloworld’ folder, you can try the ‘truffle init’ command.

  3. That should create the truffle files and folders.

tell us if it still doesn’t work.

Good luck. :wink:

Ivo

2 Likes

Ivo,

Thank you for your quick response. I’ll fix my folder mess.

1 Like

Hi @Dora

In addition to @ivga80 advise i ll recommend you to do first a

npm init

It will create your package.json file, after asking you few information about your project (you can just keep pressing enter).
Then

npm install [email protected]

Npm will add the truffle dependency to your node_modules,

The error message is showing up because npm doesn’t find the package.json file.

2 Likes

Hey @ivga80, thanks for the recommendation. I am having a hard time installing this truffle on Windows 10. Got some errors because of the permission, like other users. Tried to install CMDer but Windows Protect prevents it from opening… can’t go around that. Now trying to use Command Prompt so let’s see how this goes… Also tried in my MacBook but was another nightmare… After successfully installing truffle (without -g) tried to init but always got the message “command not found: truffle”… lol. Thanks for any suggestions!

Hey Guys

I set up Ganache under Windows 10 and have running truffle on Ubuntu under WSL. Now, I tried to add my contract in Ganache and getting following error:
:warning: Unhandled Error:
Could not find ‘node’. Node.js is required to be installed to link Truffle projects.
Check the project configuration or try restarting Ganache.
Is it possible to run Ganache GUI with contracts without node installed on Windows. I have nodejs on my WSL.

Hi @mx_krzak

If you have linked the truffle config of your project when you have started ganache it should work but you ll not have information about your contract in the contract page that’s it.

You need to have node installed to see additional information but otherwise it ll work.

This issue could be because ganache gui doesn’t find node in your PATH. I think @ivga80 could have more info about setting this up on windows.

I will have to do a google search and find out. I just run it all on Win10 or Mac OS.
Ivo

I think the behavior on WSL and windows native are the same no ? I didn’t want to give you extra google search by tagging you eheh :wink:
I got this error on linux and it was ganache which was not able to find my environment variable

If you have linked the truffle config of your project when you have started ganache it should work but you ll not have information about your contract in the contract page that’s it.

This is what I exactly miss. I thought my contract won’t work. Now I understand that I need nodejs on Windows for Ganache to display this additional info. Even if I’am able to point PATH to \$wsl… for node it won’t work since it is linux version. I found there is ganache-cli I can use to have all tools besides Visual Studio on WSL. However it seems ganache-cli needs more effort on startup.

Personally i am using ganache-cli on linux, their is an issue with the last ganache gui version it’s not sending back the event so it’s better to use ganache-cli.

just do a npm install ganache-cli in your project and to start it ganache-cli -d is the easiest way to start. You can pimp this command with a lot of parameters when you will get use to it

2 Likes

Hi everyone and @filip,

in Lesson4 I was able to migrate and deploy my Helloworld contract successfully. The function .getMessage() is working as expected. The .setMessage() returns an error. Any suggestions why is that?

Hi @Dora
Their is an other error, in you truffle console before.

Instance has already been declared

My guess is you tried to declare two times the instance, the first time you assigned your deployed contract to instance you didn’t have the setMessage() .
The second time you tried to assign the deployed contract to instance, it fails because you need to use an other variable name, or just assigning to instance without the let.

3 Likes

@gabba, thank you for answering my question. I’ll work on fixing it.

1 Like

thanks @CryptoDev.
It worked perfectly.

1 Like

OK thanks for the hint. I succesfully started to use ganache-cli with truffle. However I’am missing how to check ballance or contract details like gnanache for Windows allows. I reviewed options but I have no clue how to check them.

Hi @mx_krzak
You can use truffle console, define your environment in the truffle config file :

  networks: {
    development: {
      host: "127.0.0.1",
      port: 8545,
      network_id: "*" // Match any network id
    }
  }

Then start truffle with truffle console --network development
In you truffle console use type this commands:

accounts = web3.eth.accounts
accounts.forEach(function(a){ console.log(a + " - " + web3.fromWei(web3.eth.getBalance(a), 'ether')) })

Edit: You can also import one of your private key into metamask to check your balance and sign transactions

1 Like

Hi @filip!
I can’t start truffle after installation. An Error occours that power shell can not find “truffel”

Do I’ve to set up a global variable? If yes, where is the src folder from truffle?

thanks daniel