You are trying to dowload or clone the source of ganache from github ?
You don’t need to compile ganache by your self, there is pre compile version on ganache available online, just download it from here:
Thanks @gabba
I am using Windows 10 Home (64-bit OS).
When I executed the command you gave me, I got the following error. Is there any specific location from which I need to execute this command or can I execute this from anywhere? I ran this on powershell as administrator.
PS C:\WINDOWS\system32> Set -ExecutionPolicy RemoteSigned
Set-Variable : A parameter cannot be found that matches parameter name ‘ExecutionPolicy’.
At line:1 char:5
- Set -ExecutionPolicy RemoteSigned
-
~~~~~~~~~~~~~~~~
- CategoryInfo : InvalidArgument: ( [Set-Variable], ParameterBindingException
- FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.SetVariableCommand
PS C:\WINDOWS\system32> Get -ExecutionPolicy
Get : The term ‘Get’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
- Get -ExecutionPolicy
-
+ CategoryInfo : ObjectNotFound: (Get:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
The following command worked, I reckon
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force;
The truffle installation output is as follows:
PS C:\WINDOWS\system32> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force;
PS C:\WINDOWS\system32> npm install -g [email protected]
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.)
C:\Users\simpl\AppData\Roaming\npm\truffle -> C:\Users\simpl\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js
[email protected] postinstall C:\Users\simpl\AppData\Roaming\npm\node_modules\truffle
node ./scripts/postinstall.js
- Fetching solc version list from solc-bin. Attempt #1
- [email protected]
updated 1 package in 35.88s
I tried to download Ganache from the portal you gave me, it is throwing this error “Failed - Network error” towards the end of downloading. Eventually the download fails.
Hi @simplyprado
You can run it from everywhere in your powershell command line be careful there is no space between Set and -ExecutionPolicy
it’s Set-ExecutionPolicy and Get-ExecutionPolicy
I can see a space in your command.
It’s weird that you have an error from Ganache web site maybe a problem with your connexion. It works last time i tried.
Otherwise you can also install ganache with npm:
npm install ganache-cli
PS C:\WINDOWS\system32> npm install ganache-cli
npm ERR! code EINTEGRITY
npm ERR! sha512-VPBumkNUZzXDRQwVOby5YyQpd5t1clkr06xMgB28lZdEIn5ht1GMwUskOTFOAxdkQ4J12IWP0gdeacVRGowqbA== integrity checksum failed when using sha512: wanted sha512-VPBumkNUZzXDRQwVOby5YyQpd5t1clkr06xMgB28lZdEIn5ht1GMwUskOTFOAxdkQ4J12IWP0gdeacVRGowqbA== but got sha512-A16POSHNkkX9i0GYsV0w9bkAEcUT/TqDSxrP1D2O05Ap6NVIWx40Xe0pDNJIHbLv2muQzAQ6jHeb/rZapk9/XA==. (3672464 bytes)
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\simpl\AppData\Roaming\npm-cache_logs\2020-05-11T21_31_50_782Z-debug.log
Hi @simplyprado
Why are you located in PS C:\WINDOWS\system32 ?
This folder is where most of your operating system files are located, this is a terrible place to install your project dependencies .
npm install
(without -g ) is going to install node-modules in the directory so do not do that, otherwise use the -g to install it globally.
So to solve your issue go where your project is located, if you don’t have this file package.json start by doing this commands.
npm init
npm install ganache-cli
Otherwise is you already have a package.json file in your project folder, clean everything with the following command:
rm -rf node_modules
rm package-lock.json
npm cache clean --force
npm install ganache-cli --verbose
If after that you still have an issue share your log here
oh boy, still no luck.
MiAms-iMac:advancedsoliditycourse iMac$ npm install -g [email protected]
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/iMac/.npm/_logs/2020-05-16T01_43_59_732Z-debug.log
woah… okay so I used
sudo -s
and that allowed me to access th folder and install truffle… I am going to see if I can go on with the course now!!!
ML
Hi @Blockchain4MiAm
Your user doesn’t have the correct right on the /usr/local/lib/node_modules
folder
If you want to solve it you can change the permission of this folder instead of install it with sudo (which is the “super Admin” user )
sudo chown -R $USER /usr/local/lib/node_modules
Hi @filip
When trying to install truffle (I am on a Mac) the terminal gave me “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”
I reinstalled as sudo and it worked OK. My question is: is it OK to install truffle as sudo?
Hi @martintokyo
You can, but it’s better to set the correct permission on your global folder, see my previous message.
Otherwise all the package you will install with sudo will have the superAdmin user persmission (the user root)
Thanks gabba for this rapid reply. I will do so.
the threading on this forum needs work. It’s not clear who is answering who.
hey @filip or any other knowledgeable person!
I am stuck when trying to execute the test. I can’t see why it’s not working. I have checked my code and checked it against yours. I have tried it on two systems with almost identical errors:
TypeError [ERR_INVALID_REPL_INPUT]: Listeners for `uncaughtException` cannot be used in the REPL
at process.<anonymous> (repl.js:259:15)
at process.emit (events.js:327:22)
at process.emit (C:\Users\username\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\source-map-support\source-map-support.js:465:1)
at processEmit [as emit] (C:\Users\username\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\signal-exit\index.js:155:1)
at _addListener (events.js:358:14)
at process.addListener (events.js:406:10)
at Runner.run (C:\Users\username\AppData\Roaming\npm\node_modules\truffle\node_modules\mocha\lib\runner.js:868:11)
at Mocha.run (C:\Users\username\AppData\Roaming\npm\node_modules\truffle\node_modules\mocha\lib\mocha.js:612:17)
at C:\Users\username\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\test.js:128:1
at new Promise (<anonymous>)
at Object.run (C:\Users\username\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\test.js:127:1)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
I don’t think it’s the code, because it compiles and deploys correctly and functions and also, even when all the code in the test file is commented out, it still throws the same error :-S
Hi @Kiki
On which system did you try as i can see this one is Windows, what is the other one ?
Can you share your version of node and truffle ?
You can use the following answers to solve your REPL issue.
Or the one reinstall Node version 10.18.0 with nvm
https://forumtest.ivanontech.com/t/introduction-to-unit-testing/10052/45
Hello @filip
I follow do everything exactly as you show in the video but then I get an error. I’m doing everything on Windows terminal
First I do this and it works fine:
let instance = await Helloworld.deployed()
But then I want to call the getMessage function:
instance.getMessage()
It gives the following error:
Uncaught TypeError: instance.getMessage is not a function
Although I checked in the instance and it does contain the getMessage function as is shown in the video.
Could you please help me solve this issue?
Hi @Cemil
Can you share your migration file ?
Use the preformatted tag to display your code correctly
thx you
Hi @gabba
Here is my 1_initial_migration.js file
const Migrations = artifacts.require("Migrations");
module.exports = function(deployer) {
deployer.deploy(Migrations);
};
And this is the 2_Helloworld_deploy.js file
const Helloworld = artifacts.require("Helloworld");
module.exports = function(deployer) {
deployer.deploy(Helloworld);
};
Many thanks,
Cemil
Hi @Cemil
Your migration files are correct, i guess
const Helloworld = artifacts.require("Helloworld");
Is also included in you test.js ?
Can you try this command
truffle migrate --reset
And try again ?