Learning Truffle

hey everyone, I’m having some errors installing truffle even after trying to reinstall it and tried npm install -g truffle --force. But i get the following errors. Can anyone please help?

Hey guys, anyone knows what’s wrong?
Been trying to install truffle on my machine today (MacOS latest version), but keep getting this errors in the terminal:

npm ERR! code EACCES

npm ERR! syscall mkdir

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

npm ERR! errno -13

npm ERR! Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/truffle’

npm ERR! [Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/truffle’] {

npm ERR! errno: -13,

npm ERR! code: ‘EACCES’,

npm ERR! syscall: ‘mkdir’,

npm ERR! path: ‘/usr/local/lib/node_modules/truffle’

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/daanboshoven/.npm/_logs/2022-04-11T14_09_30_706Z-debug-0.log

Have node.js, homebrew and Ganache installed.
Any help would be greatly appreciated :grinning:

1 Like

you should create a seperate mint function outside of the constructor and call this after your contract is deployed

yeah this is an annoying error sometimes. to resolve it you should open your terminal as an administrator. i know how to do this on windows you can just right click and the option comes up to open your terminal as the administrator.

however from doing this quick google search a result came up saying that to use a terminal as an admin on mac you simply can

" To run commands with superuser privileges, use the sudo command . sudo stands for superuser do. You’re asked for the password of the current user. You’re asked to enter the password for adminUsername, after which a new shell is opened for that user."

let me know how you get on with this

Hi !!

I have the same problem right now, I don’t understand how I pass the requested params.

Thanks in advance.

1 Like

is this for the advanced migrations lesson?

can u elaborate a little more onto which params and what context, like for a smart conract function or in the constructor or in migrations etc?

Hi, yes.

This is for the truffle multi-sig wallet assignment to practice using the terminal.
this is final code:

pragma solidity 0.7.5;
pragma abicoder v2;

contract Wallet {
    address[] public owners;
    uint limit;
    
    struct Transfer{
        uint amount;
        address payable receiver;
        uint approvals;
        bool hasBeenSent;
        uint id;
    }
    
    event TransferRequestCreated(uint _id, uint _amount, address _initiator, address _receiver);
    event ApprovalReceived(uint _id, uint _approvals, address _approver);
    event TransferApproved(uint _id);

    Transfer[] transferRequests;
    
    mapping(address => mapping(uint => bool)) approvals;
    
    //Should only allow people in the owners list to continue the execution.
    modifier onlyOwners(){
        bool owner = false;
        for(uint i=0; i<owners.length;i++){
            if(owners[i] == msg.sender){
                owner = true;
            }
        }
        require(owner == true);
        _;
    }
    //Should initialize the owners list and the limit 
    constructor(address[] memory _owners, uint _limit) {
        owners = _owners;
        limit = _limit;
    }
    
    //Empty function
    function deposit() public payable {}
    
    //Create an instance of the Transfer struct and add it to the transferRequests array
    function createTransfer(uint _amount, address payable _receiver) public onlyOwners {
        emit TransferRequestCreated(transferRequests.length, _amount, msg.sender, _receiver);
        transferRequests.push(
            Transfer(_amount, _receiver, 0, false, transferRequests.length)
        );
        
    }
    
    //Set your approval for one of the transfer requests.
    //Need to update the Transfer object.
    //Need to update the mapping to record the approval for the msg.sender.
    //When the amount of approvals for a transfer has reached the limit, this function should send the transfer to the recipient.
    //An owner should not be able to vote twice.
    //An owner should not be able to vote on a tranfer request that has already been sent.
    function approve(uint _id) public onlyOwners {
        require(approvals[msg.sender][_id] == false);
        require(transferRequests[_id].hasBeenSent == false);
        
        approvals[msg.sender][_id] = true;
        transferRequests[_id].approvals++;
        
        emit ApprovalReceived(_id, transferRequests[_id].approvals, msg.sender);
        
        if(transferRequests[_id].approvals >= limit){
            transferRequests[_id].hasBeenSent = true;
            transferRequests[_id].receiver.transfer(transferRequests[_id].amount);
            emit TransferApproved(_id);
        }
    }
    
    //Should return all transfer requests
    function getTransferRequests() public view returns (Transfer[] memory){
        return transferRequests;
    }
    
    
}

this is the error message:

3_multisigWallet_migration.js

Deploying ‘Wallet’

*** Deployment Failed ***

“Wallet” – Invalid number of parameters for “undefined”. Got 0 expected 2!.

Exiting: Review successful transactions manually by checking the transaction hashes above on Etherscan.

Error: *** Deployment Failed ***

“Wallet” – Invalid number of parameters for “undefined”. Got 0 expected 2!.

1 Like

@alejandravisa yeah i know what the issue. is unlike the simple helloworld contract, the multisig contract has a constructor. this means that on the creation of the contract it takes in external arguments in order to initialise some of the global variables in the contract.

so thats whats causing that error you see saying invalid number of parameters for "undefined" got 0 expected two. so you have 2 arguments in your constructor that your not passing into your contract on creation.

truffle works a lot differently than remix. remix does everything under the hood for the user in terms of deployment and migration etc. however in truffle it smuch more low level and you have to configure everything yourself, from the migration files, to the networks and other configuration parameters in truffle.config.js. so in order to pass in arguments for use in the constructor you need to do this in your wallet Migration file. so based on your contract above i can see that you need an array of addresses for the owners and an unsigned interger for the limit.
so your current migrations file probably looks like this

const Wallet = artifacts.require("Wallet");

module.exports = (deployer) => {
  deployer.deploy(Wallet, _owners, _limit)
}

however the error is throing at this line

 deployer.deploy(Wallet, _owners, _limit)

this is where you need to add your constructor args, namely the array of owners and the limit. so in your wallet migrations file make these changes

const Wallet = artifacts.require("Wallet");

//we can add extra params such as the accounts
module.exports = (deployer, network, accounts) => {
  //accounts is an array of 9 accounts these are the accounts yu
  //see when you frst open truffle devlop. so to create our array
  ///we can index the accounts array like so
  const _owners = [accounts[0], accounts[1], accounts[2]]
  const _limit = 2
  

   //then to deploy you pass in the name of the contract you
   //want to deploy as usual and then your constructor
   //arguments as extra parameters
  deployer.deploy(Wallet, _owners, _limit)
}

so this will now work. read the comments i put into the code for extra info. and let me know if you have any further issues

Thank you so much !!! Now it works :grinning:

1 Like

Hello,

I always get the same error:

Error: Cannot find module './uws_win32_x64_108.node'
Falling back to a NodeJS implementation; performance may be degraded.

I already did a uninstall and a reinstall with the force flag but it keeps giving me this error.
Can you help me please.

1 Like

when does this error come. is it when you try to npm install truffle or when you try to run truffle init or when you try to do a command like truffl ecompile or truffle migrate??

This error first came when I did truffle init (the truffle compile or truffle migrate i don’t know), but after I reinstalled truffle i saw this in the node.js screen right after the install.

This doesn’t look right.

![1|414x500](upload://7cnl2Y9x5jcSwwaCwRu

Z13pw5e4.png)

It says INSTANCE.HELLO is not a function???

can someone help please

think u need instance.Helllo ?

this is what I get in my virtual studio terminal. Just to be clear :sweat_smile:

I noticed it says µWs is not compatible with your Node.js build … but I don’t find what I should do :expressionless:

mubashirhussain@Mubashirs-MBP helloworld % truffle complie

Compiling your contracts…

✓ Fetching solc version list from solc-bin. Attempt #1
✓ Downloading compiler. Attempt #1.
✓ Downloading compiler. Attempt #2.
:heavy_multiplication_x: Downloading compiler. Attempt #3.
Error: Could not find a compiler version matching 0.8.0. Please ensure you are specifying a valid version, constraint or build in the truffle config. Run truffle compile --list to see available versions.
at VersionRange.getSatisfyingVersionFromCache (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/dist/compilerSupplier/loadingStrategies/VersionRange.js:134:1)
at VersionRange. (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/dist/compilerSupplier/loadingStrategies/VersionRange.js:54:1)
at Generator.throw ()
at rejected (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/dist/compile
mubashirhussain@Mubashirs-MBP helloworld % npm uninstall -g truffle

npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/truffle
npm ERR! dest /usr/local/lib/node_modules/.truffle-ojTgnptm
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename ‘/usr/local/lib/node_modules/truffle’ -> ‘/usr/local/lib/node_modules/.truffle-ojTgnptm’
npm ERR! [Error: EACCES: permission denied, rename ‘/usr/local/lib/node_modules/truffle’ -> ‘/usr/local/lib/node_modules/.truffle-ojTgnptm’] {
npm ERR! errno: -13,
npm ERR! code: ‘EACCES’,
npm ERR! syscall: ‘rename’,
npm ERR! path: ‘/usr/local/lib/node_modules/truffle’,
npm ERR! dest: ‘/usr/local/lib/node_modules/.truffle-ojTgnptm’
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/mubashirhussain/.npm/_logs/2022-05-04T12_36_50_203Z-debug.log
mubashirhussain@Mubashirs-MBP helloworld % sudo npm uninstall -g truffle

Password:

removed 838 packages, and audited 1 package in 2s

found 0 vulnerabilities
mubashirhussain@Mubashirs-MBP helloworld % sudo npm install -g [email protected]

npm WARN deprecated [email protected]: This package is broken and no longer maintained. ‘mkdirp’ itself supports promises now, please switch to that.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: “Please update to latest v2.3 or v2.2”
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated @nodefactory/[email protected]: Package is deprecated in favour of @chainsafe/filsnap-adapter
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by @ipld/dag-cbor and multiformats
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
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 deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by @ipld/dag-pb and multiformats
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module

added 853 packages, and audited 854 packages in 2m

89 packages are looking for funding
run npm fund for details

15 vulnerabilities (2 moderate, 12 high, 1 critical)

To address issues that do not require attention, run:
npm audit fix

Some issues need review, and may require choosing
a different dependency.

Run npm audit for details.
mubashirhussain@Mubashirs-MBP helloworld % truffle version
Truffle v5.4.18 (core: 5.4.18)
Solidity - 0.8.0 (solc-js)
Node v16.13.1
Web3.js v1.5.3
mubashirhussain@Mubashirs-MBP helloworld % truffle migrate

Compiling your contracts…

:heavy_check_mark: Fetching solc version list from solc-bin. Attempt #1
:heavy_check_mark: Downloading compiler. Attempt #1.
:heavy_check_mark: Downloading compiler. Attempt #2.
Error: Could not find a compiler version matching 0.8.0. Please ensure you are specifying a valid version, constraint or build in the truffle config. Run truffle compile --list to see available versions.
at VersionRange.errors (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/compilerSupplier/loadingStrategies/LoadingStrategy.js:66:1)
at VersionRange.getSatisfyingVersionFromCache (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/compilerSupplier/loadingStrategies/VersionRange.js:87:1)
at VersionRange.load (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/compilerSupplier/loadingStrategies/VersionRange.js:205:1)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at CompilerSupplier.load (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/compilerSupplier/index.js:71:1)
at loadParser (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/profiler/loadParser.js:15:29)
at Object.requiredSources (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/profiler/index.js:19:1)
at Object.sourcesWithDependencies (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/index.js:139:45)
at necessary (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/index.js:106:1)
at /usr/local/lib/node_modules/truffle/build/webpack:/packages/workflow-compile/index.js:35:1
at async Promise.all (index 0)
at compile (/usr/local/lib/node_modules/truffle/build/webpack:/packages/workflow-compile/index.js:25:1)
at Object.compile (/usr/local/lib/node_modules/truffle/build/webpack:/packages/workflow-compile/index.js:68:47)
at Object.compileAndSave (/usr/local/lib/node_modules/truffle/build/webpack:/packages/workflow-compile/index.js:99:47)
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:199:1)
Truffle v5.4.18 (core: 5.4.18)
Node v16.13.1
mubashirhussain@Mubashirs-MBP helloworld % sudo npm uninstall -g truffle

removed 853 packages, and audited 1 package in 2s

found 0 vulnerabilities
mubashirhussain@Mubashirs-MBP helloworld % sudo 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.)

added 27 packages, and audited 28 packages in 15s

3 vulnerabilities (2 moderate, 1 critical)

To address all issues (including breaking changes), run:
npm audit fix --force

Run npm audit for details.
mubashirhussain@Mubashirs-MBP helloworld % truffle version
Error: EACCES: permission denied, open ‘/Users/mubashirhussain/.config/truffle/config.json’
You don’t have access to this file.

at Object.openSync (node:fs:585:3)
at Object.readFileSync (node:fs:453:35)
at Configstore.get all [as all] (/usr/local/lib/node_modules/truffle/build/webpack:/~/configstore/index.js:31:1)
at new Configstore (/usr/local/lib/node_modules/truffle/build/webpack:/~/configstore/index.js:25:31)
at Function.getUserConfig (/usr/local/lib/node_modules/truffle/build/webpack:/packages/config/dist/index.js:151:1)
at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/mnemonics/mnemonic.js:11:1)
at __webpack_require__ (/usr/local/lib/node_modules/truffle/build/webpack:/webpack/bootstrap 45f436e53fa694e98811:19:1)
at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/develop.js:2:22)
at __webpack_require__ (/usr/local/lib/node_modules/truffle/build/webpack:/webpack/bootstrap 45f436e53fa694e98811:19:1)
at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/index.js:9:12)
at __webpack_require__ (/usr/local/lib/node_modules/truffle/build/webpack:/webpack/bootstrap 45f436e53fa694e98811:19:1)
at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/cli.js:33:29)
at __webpack_require__ (/usr/local/lib/node_modules/truffle/build/webpack:/webpack/bootstrap 45f436e53fa694e98811:19:1)
at /usr/local/lib/node_modules/truffle/build/webpack:/webpack/bootstrap 45f436e53fa694e98811:65:1
at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:71:10)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47

mubashirhussain@Mubashirs-MBP helloworld % npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.

See npm help init for definitive documentation on these fields
and exactly what they do.

Use npm install <pkg> afterwards to install a package and
save it as a dependency in the package.json file.

Press ^C at any time to quit.
package name: (helloworld)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
About to write to /Users/mubashirhussain/Documents/Ehereruim-201/helloworld/package.json:

{
“name”: “helloworld”,
“version”: “1.0.0”,
“description”: “”,
“main”: “index.js”,
“scripts”: {
“test”: “echo “Error: no test specified” && exit 1”
},
“author”: “”,
“license”: “ISC”
}

Is this OK? (yes)
mubashirhussain@Mubashirs-MBP helloworld % truffle init
Error: EACCES: permission denied, open ‘/Users/mubashirhussain/.config/truffle/config.json’
You don’t have access to this file.

at Object.openSync (node:fs:585:3)
at Object.readFileSync (node:fs:453:35)
at Configstore.get all [as all] (/usr/local/lib/node_modules/truffle/build/webpack:/~/configstore/index.js:31:1)
at new Configstore (/usr/local/lib/node_modules/truffle/build/webpack:/~/configstore/index.js:25:31)
at Function.getUserConfig (/usr/local/lib/node_modules/truffle/build/webpack:/packages/config/dist/index.js:151:1)
at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/mnemonics/mnemonic.js:11:1)
at __webpack_require__ (/usr/local/lib/node_modules/truffle/build/webpack:/webpack/bootstrap 45f436e53fa694e98811:19:1)
at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/develop.js:2:22)
at __webpack_require__ (/usr/local/lib/node_modules/truffle/build/webpack:/webpack/bootstrap 45f436e53fa694e98811:19:1)
at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/index.js:9:12)
at __webpack_require__ (/usr/local/lib/node_modules/truffle/build/webpack:/webpack/bootstrap 45f436e53fa694e98811:19:1)
at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/cli.js:33:29)
at __webpack_require__ (/usr/local/lib/node_modules/truffle/build/webpack:/webpack/bootstrap 45f436e53fa694e98811:19:1)
at /usr/local/lib/node_modules/truffle/build/webpack:/webpack/bootstrap 45f436e53fa694e98811:65:1
at Object.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:71:10)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47

mubashirhussain@Mubashirs-MBP helloworld % sudonpm install -g truffle

zsh: command not found: sudonpm
mubashirhussain@Mubashirs-MBP helloworld % sudo npm install -g truffle

npm WARN deprecated [email protected]: This package is broken and no longer maintained. ‘mkdirp’ itself supports promises now, please switch to that.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated @nodefactory/[email protected]: Package is deprecated in favour of @chainsafe/filsnap-adapter
npm WARN deprecated [email protected]: This module has been superseded by @ipld/dag-cbor and multiformats
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: This module has been superseded by @ipld/dag-pb and multiformats
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module
npm WARN deprecated [email protected]: This module has been superseded by the multiformats module

added 811 packages, changed 27 packages, and audited 839 packages in 2m

87 packages are looking for funding
run npm fund for details

12 high severity vulnerabilities

To address issues that do not require attention, run:
npm audit fix

Some issues need review, and may require choosing
a different dependency.

Run npm audit for details.
mubashirhussain@Mubashirs-MBP helloworld % truffle init

Starting init…

Copying project files to /Users/mubashirhussain/Documents/Ehereruim-201/helloworld

Init successful, sweet!

Try our scaffold commands to get started:
$ truffle create contract YourContractName # scaffold a contract
$ truffle create test YourTestName # scaffold a test

http://trufflesuite.com/docs

mubashirhussain@Mubashirs-MBP helloworld % truffle compile

Compiling your contracts…

✓ Fetching solc version list from solc-bin. Attempt #1
✓ Downloading compiler. Attempt #1.
✓ Downloading compiler. Attempt #2.
:heavy_multiplication_x: Downloading compiler. Attempt #3.
Error: Could not find a compiler version matching 0.8.13. Please ensure you are specifying a valid version, constraint or build in the truffle config. Run truffle compile --list to see available versions.
at VersionRange.getSatisfyingVersionFromCache (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/dist/compilerSupplier/loadingStrategies/VersionRange.js:134:1)
at VersionRange. (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/dist/compilerSupplier/loadingStrategies/VersionRange.js:54:1)
at Generator.throw ()
at rejected (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/dist/compilerSupplier/loadingStrategies/VersionRange.js:6:42)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Truffle v5.5.12 (core: 5.5.12)
Node v16.13.1
mubashirhussain@Mubashirs-MBP helloworld % truffle compile -list

Compiling your contracts…

✓ Fetching solc version list from solc-bin. Attempt #1
✓ Downloading compiler. Attempt #1.
✓ Downloading compiler. Attempt #2.
:heavy_multiplication_x: Downloading compiler. Attempt #3.
Error: Could not find a compiler version matching 0.8.13. Please ensure you are specifying a valid version, constraint or build in the truffle config. Run truffle compile --list to see available versions.
at VersionRange.getSatisfyingVersionFromCache (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/dist/compilerSupplier/loadingStrategies/VersionRange.js:134:1)
at VersionRange. (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/dist/compilerSupplier/loadingStrategies/VersionRange.js:54:1)
at Generator.throw ()
mubashirhussain@Mubashirs-MBP helloworld % sudo uninstall -g solc
Password:
sudo: uninstall: command not found
mubashirhussain@Mubashirs-MBP helloworld % solc --version
zsh: command not found: solc
mubashirhussain@Mubashirs-MBP helloworld % truffle compile

Compiling your contracts…

✓ Fetching solc version list from solc-bin. Attempt #1
✓ Downloading compiler. Attempt #1.
✓ Downloading compiler. Attempt #2.
:heavy_multiplication_x: Downloading compiler. Attempt #3.
Error: Could not find a compiler version matching 0.8.0. Please ensure you are specifying a valid version, constraint or build in the truffle config. Run truffle compile --list to see available versions.
at VersionRange.getSatisfyingVersionFromCache (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/dist/compilerSupplier/loadingStrategies/VersionRange.js:134:1)
at VersionRange. (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/dist/compilerSupplier/loadingStrategies/VersionRange.js:54:1)
at Generator.throw ()
at rejected (/usr/local/lib/node_modules/truffle/build/webpack:/packages/compile-solidity/dist/compilerSupplier/loadingStrategies/VersionRange.js:6:42)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Truffle v5.5.12 (core: 5.5.12)
Node v16.13.1
mubashirhussain@Mubashirs-MBP helloworld %

I see truffle has a VS code extension now. I haven’t used it but was curious if anyone else has? Is it recommended to be using that instead when creating projects on our own?

Hello, I am trying to install truffle but am running into some problems. The first thing I did was download and install node.js 16.15.1, and then went to my computer`s command prompt and attempted to install truffle, which didn’t work so I uninstalled and tried to reinstall with --force. Do I need to do anything else first, any help would be appreciated.
Thanks

1 Like

Hey, I was having the same problem yesterday. I think I fixed the location problem by updating my npm with the following steps.
image

2 Likes