Truffle Introduction

I tried the following :

sudo chown -R `whoami` ~/.npm
sudo chown -R `whoami` /usr/local/lib/node_modules

from https://www.willandskill.se/en/how-to-fix-eacces-errors-with-npm-on-macos/

but still no dice, please help!

Hi @Hogie

I looked in the forum as other student had the same message from PowerShell.
This seem to fix:

In a admin powershell run Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser to make the current user always able to run scripts else if you just want it to be able to run it for the current shell session you would the need to change the scope to Process instead of CurrentUser.
You can read more about it here
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7

Regards,
Dani

Hi @mervxxgotti

Run sudo npm install -g truffle and you should be alright.
You will get a bunch of warnings but you can ignore them.
Once done, check if truffle is installed by trying truffle -v.

Regards,
Dani

1 Like

I’m here at Ethereum Smart Contract Programming 201 / Categories / Truffle Introduction / Setter Function. After adding the setter function, and run migrate --reset, Im getting this error:“TypeError: Cannot read property ‘imports’ of undefined”
Why? I just added a setter() function. It was ok in the getter()
HelloWorld:
pragma solidity 0.8.1;
.
.
truffle-config.js
compilers: {
solc: {
version: “0.8.1”,

I run this command : npm update -g truffle
then a new error message comes up :
Unknown network “ganache”. See your Truffle configuration file for available networks.

To solve this, I run these 3 commands:
npm uninstall -g truffle > npm install -g truffle > truffle init .

Is this the right way? bec I have to retype everything.

Hey @padlanau

You can just add the right settings to your truffle config so that it recognises Ganache.

Check out my suggestion to another student

Cheers,
Dani

it worked!! Thank you!!

1 Like

When I change my code and save on Atom, I’m not sure if it’s properly updating with Ganache?When I use >truffle console and the >migrate – reset I get this error:

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

Is there some configuration I need to change?

Hey @mervxxgotti

Please check couple of posts above this one, I answered the same question to another student :slight_smile:
Check it out and tell me if it helps!

Happy coding,
Dani

1 Like

I sent a screenshot to u that my truffle was successful installed but it wasn’t I just checked it now it saying the term truffle isn’t recognize so I try to install it again it bring up error pls wat should i do

Here is a screenshot

I followed the instructions here as requested: Unit Testing in Truffle

as well as the uninstall and re-install of truffle and now i get the following report - is this an issue?

Thanks for the help!

Hi @beloved

Run PowerShell as admin an try again.

Hi @mervxxgotti

Seems installed correctly. Run truffle -v, if you get info back it’s installed.

Cheers,
Dani

@MrSeven
This means that you already declared this instance. If you type: instance and hit enter, it should return a list of all methods of the deployed contract. Note that you can also declare a new instance with let instance = await Helloworld.new()

I have done it I created a new folder using mkdir hello-blockchain and changed the directory to hello-blockchain and then installed it it was successful and I run truffle init and it work here are screenshots

The compiler version was upgrade here are the list of my compiler version
My question is which one will I input

thank you man it helped but the course got updated lol :slight_smile:

yup all good now thanks!

Hi all, I love this course but I think I downloaded the wrong truffle version. The Truffle version I’m working with is v5.2.2 and the Soldity version is v0.5.16.
When I wanted to compile my contract it said this

Compiling your contracts...
===========================
> Compiling ./contracts/Functional.sol
> Compiling ./contracts/Storage.sol
> Compilation warnings encountered:

    /Users/sk/proxyContract/contracts/Functional.sol:1:1: Warning: Source file does not specify required compiler version! Consider adding "pragma solidity ^0.5.16;"

^
,/Users/sk/proxyContract/contracts/Storage.sol:1:1: Warning: Source file does not specify required compiler version! Consider adding "pragma solidity ^0.5.16;"

^

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

I don’t know what I’ve to do to fix this, or is it good?
Tried to change the pragma solidity to

pragma solidity ^0.5.16;

but still the same error. Does anyone know what I’ve to do?

I thought I fixed it by updating Truffle, but after that was done both the Storage.sol and Function.sol was gone. Had to make the contracts again, but it still gives me the same error.
I tried searching the web for the answer, but didn’t find anything that can help me…