Truffle Introduction

Fixed by adding the following to networks section in truffle-config.js
ganache: {
host: “localhost”,
port: 7545,
network_id: “5777”
}

2 Likes

I am having trouble launching truffle whenever I run “truffle inti” I get this alert.
How do I enable the system to allow execution?

Cheers :slight_smile:

1 Like

@filip

I’m not sure what happened to my setup. Everything between ganache and truffle was working fine some weeks ago, but after some other installations I did on my computer, it seems the migration does not work properly anymore for the ‘people project’.

I launch ganache and link it to the project. Then I do ‘truffle console’ and then I run 'migrate --reset" and i get this:

Compiling your contracts...
===========================
> Compiling .\contracts\Ownable.sol
> Artifacts written to C:\Users\innov\Web Projects\Blockchain\programming\Peopleproject\build\contracts
> Compiled successfully using:
   - solc: 0.5.12+commit.7709ece9.Emscripten.clang

ExtendableError: Unknown network "ganache". See your Truffle configuration file for available networks.
    at Object.validateNetworkConfig (C:\Users\innov\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\environment\environment.js:110:1)
    at Object.detect (C:\Users\innov\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\environment\environment.js:16:1)
    at C:\Users\innov\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate.js:206:1

I can’t find anything on Google about this error. Also it looks like just the Ownable contract is getting compiled for some reason, not the migrate or people contracts. Any ideas?

UPDATE:
OK, I didn’t have any settings in the truffle.config.js file under networks. It was all commented out. So I checked the settings in Ganache and put them in there and now all is working. I am still baffled as to why it was working before without me needing to do this and then suddenly not. But whatever I guess…

Thanks. But that’s not what was in the video lesson. There Filip works with ganache network. https://i.imgur.com/6HGX6Ix.png
Looks like I’m missing something…

Filip uses a ganache gui version. the one I suggested is instead a cli version :slight_smile:
You will see that you will use the cli a lot once you get expercience.

Happy to see that you solved, good job!

Dani

Hey @Alek_Bike

The command should be truffle init.

Cheers,
Dani

1 Like

Even though I installed npm6.14.4, I can’t install truffle on ubuntu.

Hi i am having issue running the npm install -g [email protected] on my Mac Terminal. I ham having this issue

Can someone help? I’m a beginner programmer here. I’ve created the simple Helloworld.sol in Atom, but all of my code appears as a single ‘green color’. What do I need to do to make Atom display the code in different colors as appropriate?

Also, how do I change the destination folder for nodes.js?

Thanks in advance!

David

My instance of “Helloworld” does not display correctly. Can someone help and let me know what I’m doing wrong?

Thanks!

David

I want to compile in the terminal with command ‘truffle compile’ but I recieve ‘truffle: command not found’
Help please
thanks

Hey @Oussama @ImRONMAN

It says 'missing write acces to /usr etc…Screenshot 2020-11-02 at 10.43.38

do sudo.

Cheers
Dani

1 Like

Hey @MrSeven

You can google if you look for syntax plugins for Atom, you will find many of them.
Take a look here: https://atom.io/packages/search?utf8=✓&q=keyword:solidity

Hey @MrSeven

From you screenshot it looks like the function name is getmessage and not getMessage

Cheers
Dani

@Abuaish seems like you don’t have truffle installed.
Type truffle -v, you should see the version and a list of commands. If not download and install truffle.

ok yeah, I checked I dont have it, How can I download
thanks

Its November the 2nd 2020, and Im using truffle v5.1.49 and ganache v2.5.4 … hope everything runs smoothly and there is backwards compatibility :pray: :pray: :pray: :pray: :pray: :pray:

1 Like

@filip could you please explain what you did when you wrote this in the truffle console:

let instance = await Helloworld.deployed()

it is like you took the contract Helloworld and you put it into a Javascript object?? so that you may interact with it without “touching” the blockchain? thus, no transaction can be seen in the ganache window??

I’m having issue when i opening my Mac terminal and input -g [email protected] . i am using my Mac admin account btw.

Hey @Abuaish

If you’re using mac or linux run npm i truffle.

Filip explains it here: https://academy.ivanontech.com/products/ethereum-smart-contract-programming-201/categories/1993907/posts/6668001

Happy learning,
Dani

Hey @javier_ortiz_mir

it is like you took the contract Helloworld and you put it into a Javascript object??
Correct.

In that way you can interact with your contract methods.
The command let instance = await Helloworld.deployed() does not create a transaction on the blockchain since what you are doing is just instantiate a variable in javascript.

Good one,
Dani

1 Like