Truffle Introduction

Hey guys!

I ran into an issue, and just want to post in case anyone had this issue.

My computer (Win 10 64 bit) would not allow truffle init command because of a security setting. in order to fix this I ran a command, listed as follows, in power shell.

Set-ExecutionPolicy -ExecutionPolicy Bypass

I don’t know if this is the best way to do it. If not, someone please correct me. However, it does work. Hopefully this helps!

Hey man,

Try just running the following command.

npm install -g truffle

The version they uploaded to the course is not the current version. Unfortunately, windows no longer supports older versions of truffle. This should install the latest version.

1 Like

Hi @mwonder

Please type truffle --version in your console to check if truffle is installed.

You should see something like this:

Screenshot 2021-01-16 at 15.20.10

Post a screenshot of the result here if you are facing issues when using truffle.

Regards,
Dani

Hi filip, what does this means ???

Hi! thank you for the help. right now i have another issue, on my terminal i input truffle compile, i keep getting this message “zsh: command not found: truffle”

in case anyone runs into the same problem, it seems i had to allocate more RAM to my vm. I was using 2048 and now i increased it to 3072 and runs perfectly

Hi guys, anyone running into this issue ?

Hey @ImRONMAN

Please type truffle --version in your console to check if truffle is installed.

You should see something like this:

Screenshot 2021-01-16 at 15.20.10

Screenshot the result and post it here.

Happy coding,
Dani

Hi @ArgenFrank

There is probably an error in your migration file.
Make sure that the contract you are migrating has the same name of your contract address.

example:

pragma solidity 0.5.0;

contract HelloWorld{}

migration:

deployer.deploy(HelloWorld);

Happy learning,
Dani

Hey dani, i managed to solve it earlier today and yes, indeed this was the problem, thank you very much for answering !

1 Like

Well done :slight_smile:

Hey everyone,
I’m stuck and I’m sure it’s a simple fix but I can’t seem to figure it out. When I updated my 2_HelloWorlddeploy contract and migrated it (used --reset) it gave me the following error below.

Compiling your contracts…

Everything is up to date, there is nothing to compile.

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

Compiling your contracts…

Everything is up to date, there is nothing to compile.

ExtendableError: Unknown network “ganache”. See your Truffle configuration file for available networks.
at Object.validateNetworkConfig (C:\Users\alanm\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\environment\environment.js:111:1)
at Object.detect (C:\Users\alanm\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\environment\environment.js:16:1)
at C:\Users\alanm\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate.js:206:1
truffle(ganache)> instance = await Helloworld.deployed()

Here is my code for the deploy contract, I believe it is the exact same that @filip has:
const HelloWorld = artifacts.require(“HelloWorld”);

module.exports = function (deployer) {
deployer.deploy(HelloWorld).then(function(instance){
instance.setMessage(“Hello Again!”).then(function(){
instance.getMessage().then(function(message){
console.log("Current message: " + message);
});
});
});
};

I got my issue solved on my own. It was small but still feels like an accomplishment. I updated everything to 0.8.0 as well as added // SPDX-License-Identifier: MIT

@filip @gabba
Hey.
So I’ve installed the truffle without -g, because it wasn’t working on my mac and I noticed that people experienced similar problems and that this seemed to have worked. It did for me as well. Then I proceeded to install Ganache. I have installed node.js already yesterday. But now I still have a problem:

When I tri the command truffle init, it says “truffle: command not found”. I have done the following:

  • created a new directory and made sure it is my current one
  • uninstalled and reinstalled truffle
  • I followed the instructions from this post

It still says truffle: command not found. Can someone please help me out?

Thanks

@ZigaP

Solved my problem by following instructions on this forum
https://www.edureka.co/community/10241/how-to-solve-truffle-command-not-found-error-in-blockchain

Hello Filip,
I am finding this section a bit confusing.
What I usually do when I can’t figure it out is to watch a few Youtube videos on the subject, and then I can usually can figure it out
DOODESVILLE

wow that stumped me for way to long, I got it figured out

Been stuck for a couple days trying to get by an issue while adding project to ganache.
Filip goes through this step in video 3 “Deploying our First Contract”

I am sure that I have completed all the steps to that point in order successfully - same truffle version, ganache version, I have node v8.9.4 (I have also tried the latest version).

I can see that my contracts have compiled successfully which is the step just before in the video.

But I get this error in Ganache,

I am on Mac Catalina v10.15.5
Has anyone run into this? Any thoughts?

I updated to the latest version on Ganache (2.5.4) and got past this error.

However, the contracts don’t show in Ganache, instead I see:

I am able to see the transactions… So I think I’ll go ahead and continue the course like this. I’ll update with how it goes.