Truffle Introduction

@Yogalholic
Thanks for reaching out!

Solidity version 0.7 is the latest version. Filip’s tutorial are before the release of this (0.7) version which was during the 0.5 version (which was the latest stable release then).

Hence, the best thing to do is to stick with 0.5.12 or above version, so you could also use latest 0.7 version.

1 Like

@Yogalholic
Truffle is a framework to develop a complete decentralised application on the EVM.
A complete application has both front-end, that is javascript (HTML, CSS including) and the back-end smart contract written in solidity.
That is why we have solidity files for back-end smart contract and javascript files for front-end interaction.

2 Likes

@filip
I get this error when I install truffle:

npm WARN deprecated [email protected]: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules

npm ERR! code EACCES

npm ERR! syscall access

npm ERR! path /usr/local/lib/node_modules

npm ERR! errno -13

npm ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’
npm ERR! [Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’] {
npm ERR! errno: -13,
npm ERR! code: ‘EACCES’,
npm ERR! syscall: ‘access’,
npm ERR! path: ‘/usr/local/lib/node_modules’
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/tomaszalemany/.npm/_logs/2020-08-20T17_22_00_149Z-debug.log

I fixed it by running: sudo chown -R $USER /usr/local/lib/node_modules

1 Like

In 101 Smart Contract we used Remix. But in 202 we don’t.
I installed Atom as the code editor, as you suggest. I searched the forum to see what package to install in Atom and someone suggested Emmet. I installed Emmet , but it doesn’t recognize .sol files.
What do I do? @filip

@elterremoto
Thanks for reaching out!
Amazing, to see you solve the first question.

yes, chown gives the ownership to the $USER and
chmod changes the permission for a file regarding read, write and execute.

You can stick to ATOM

Check the steps below:

Step 1:

Step 2:

Step 3: Install these packages

Happy coding

2 Likes

Thanks, appreciated the link describing how to npm install -g ... as a user in Linux, no need for sudo.

https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

1 Like

Hi @filip, I have a problem after downloading (npm install -g [email protected]).

after downloading it your screen shows /Documents but mine doesnt…How do i solve it???

If someone has EACCESS permission problems use this in the terminal:

sudo npm install --unsafe-perm -g truffle

https://www.mobilefish.com/developer/blockchain/blockchain_quickguide_truffle.html

When I come to the 5. step (truffle init, or truffle version) I get:

Error: EACCES: permission denied, open ‘/Users/user/.config/truffle/config.json’
You don’t have access to this file.

Tried checking firewall, clearing permissions, reinstalling nodejs, using atom package installer… and there is one simple thing that fixed it:


instead of initiating truffle with the following code:
truffle init

use this code
sudo truffle init
-----
edit: The issue persisted in the second and third lecture so I’ve tried to do it manually in the OSX finder folder and finally found the best way to solve the issue beforeand. I’m giving my full guide for solving "EACCESS: Permission denied problem.

Open Finder and go to the folder which you need to modify. In my case the path is:
STEP 1:
SSD disk --> users–>me–>ivancourse. This is the folder which cannot be accessed due to the missing permissions.
STEP 2: Rightclick Ivancourse --> Get info
At the bottom you will see Sharing options. In my case, I see for example staff, everyone and me. Enable read & write permissions (“privilege tab”) and confirm it with your password.
If you don’t see your default account “me” or “admin” or whatever, then click the + icon and add it here with read&write permissions.
STEP 3: Click the gear icon and select Apply to all enclosed items.

That’s the fix which is most user-friendly from my perspective.

But still, there are still some issues which I haven’t been able to resolve… for example I wasn’t able to compile with:
sudo truffle compile

1 Like

@filip
So far there are no issues. I was able to successfully deploy both Helloworld and Migrations.

1 Like

@bigblueben
Yes, the command does solve the issue and at the same time it also gives unsafe permission as mentioned in the command.

I suggest using chown to change the ownership or chmod to change the permission for read, write and execute.

Happy Coding!

@bigblueben
Great work!
Good to see you solve the issue yourself :slight_smile:

A brief intro about sudo
sudo command for Unix-like computer operating systems allows users to run programs with the security privileges of another user, by default the superuser.

@Marcus_Tang
Thanks for reaching out!

WARNINGs are not errors, you don’t need to worry about warnings.

trying running truffle version to check whether truffle is installed or not.

I don’t really know how to run the program but I have typed this into PowerShell (npm install -g [email protected]). THen I tried the next step but my PowerShell doesn’t show the same thing as @filip. Please help cause I can’t wait to continue this course.

@Marcus_Tang

Sure, will keep you enthusiasm continued. :slight_smile:

What I am seeing is you are trying to navigate to your directory, in macOS we use cd 'directory to the folder' (cd stands for change directory).
In windows we are directly navigating, for example :c:\ or d:'to your folder directory'

For reference: https://stackoverflow.com/questions/41130310/change-directory-in-powershell

@bigblueben
Are you able to compile with only truffle compile command?
What error are getting when you run sudo truffle compile?

Thanks

Hi @filip,
Do we need to install solidity language into atom? Apparently my atom doesn’t support solidity language.Because when key in my codes, it doesn’t get highlighted. As the bellow image is what i was saying.

Please help Thxx!!!:slight_smile:

Hi, community,
can someone help me to solve the above problem? Because is already 2 days but no one reply me.Can’t wait to solve this problem so that I can continue the course. Thanks

1 Like

Hey @Marcus_Tang

Install this one: https://atom.io/packages/language-solidity

Happy coding,
Dani

2 Likes