1

I currently have

node 12.21.0 + npm 6.14.41 + macos big sur 11.2.1 + ganache 2.5.4 + command line for xtools 12.4

I read online that truffle does not support node v13, so i uninstalled the one i had (v15 or sthing) and switched to version 12.21.1.

The latest npm and node installations were done from their website (pkg files), not brew, because i do not know how to NOT install the latest versions with brew.

Here's 2 screenshots of attempt #1:

enter image description here and enter image description here

Here's attempt #2

enter image description here

I have been looking for an answer for HOURS, and nothing works. Save my life please.

edit: someone told me to check if /Users/aris/.npm-global/bin is in my path, but i have no idea how to do it. I googled it and tried a few instructions that put that directory in my path, but nothing changed.

Truffle also seems to be installed in my hard drive (as you can see at the screenshot bellow), even though when i check at the terminal if its installed, or try to call a command, i get that "command not found: truffle": enter image description here

EDIT#2342 (excuse me for this btw) i checked and truffle is NOT in my path (screenshot bellow). Should i manually try and find the truffle executable file or sthing? enter image description here

2
  • It would be good to provide more information and not just external stored screenshots (these images can't index for search and they may not be reachable in the future). Please avoid something like "HELP!" in the subject - this is just not needed Commented Mar 13, 2021 at 11:41
  • @MarkusSprunck ok, im not sure what other information is relevant, can you tell me what you need? im running on big sur 11.2.1. Someone told me to check if /Users/aris/.npm-global/bin is in your path, but i have no idea how to do it. I googled it and tried a few isntructions to include that directory in my path but nothing changed. Commented Mar 13, 2021 at 12:02

5 Answers 5

1

try npx truffle init after you install npm and truffle

1

Tried upvoting @Praktisch's answer, but I don't have enough reputation yet.

npx worked for me. I had the same problem. Switched from zsh to bash. Added folders to execution path. No luck.

If I type npx before any of the truffle commands, they work. For example npx truffle init, npx truffle compile, etc.

0

Firstly, you can try these steps to install the version you'd need with brew: how to install node any version with brew. In any case, that can come handy.

About the issue you are facing, it's an "old" problem that has no one-trick solution, check here to see some attempts. can't install truffle on Mac OSX -- if are using a more recent Mac OS version, you don't have some compatibilities issues they present there.

You should try npm install -g truffle@beta and check command-line tools are working properly, too. In case that does not solve it, try moving to yet another version... it's a pain but sometimes there is no better choice.

PS: Also, note that relevant info, in this case, means the system you are using, your stack, etc. Anything that could potentially have an influence on the issue. Preferably in text format similar to the GitHub issue I linked. Have that in mind.

2
  • hello, thank you! i opened your link and one user says to 'Make sure you have the Xcode command line tools installed.'. i do NOT have it, do u have any idea if its a must? asking cause its a damn yuge app Commented Mar 13, 2021 at 15:11
  • Here (medium.com/coinmonks/…) it says: "We need Xcode command line tools which include compilers, utilities needed for HomeBrew to perform its activities" -- so I guess for homebrew yes but if you are not using, then no. I don't work with Macs regularly, hope this helps.
    – César P.
    Commented Mar 14, 2021 at 21:48
0

To install on macOS you should have a working C/C++ compiler installed and usually the global installation needs root rights, so use sudo.

  1. Install command line developer tools

    https://developer.apple.com/downloads/index.action

    Download 'Command Line Tools for Xcode'.

    Depending on your current OS version (the best is to install newest version). You will be asked for your Apple Developer Login during the install process.

  2. Install truffle global:

    $ sudo npm install -g truffle

  3. Ensure that all node dependencies have been updated:

    $ sudo npm update -g

  4. You should also install Ganache:

    $ sudo npm install -g ganache-cli

In the case all this does not work it is also possible to install truffle locally in your project. In this case you install without the '-g' flag and call:

`$ ./node_modules/.bin/truffle`

Expected result:

$ ./node_modules/.bin/truffle -v
Truffle v5.1.43 - a development framework for Ethereum

Usage: truffle <command> [options]

Commands:
  build     Execute build pipeline (if configuration present)
  compile   Compile contract source files
  config    Set user-level configuration options
  console   Run a console with contract abstractions and commands available
  create    Helper to create new contracts, migrations and tests
  debug     Interactively debug any transaction on the blockchain
  deploy    (alias for migrate)
  develop   Open a console with a local development blockchain
  exec      Execute a JS module within this Truffle environment
  help      List all commands or provide information about a specific command
  init      Initialize new and empty Ethereum project
  install   Install a package from the Ethereum Package Registry
  migrate   Run migrations to deploy contracts
  networks  Show addresses for deployed contracts on each network
  obtain    Fetch and cache a specified compiler
  opcode    Print the compiled opcodes for a given contract
  publish   Publish a package to the Ethereum Package Registry
  run       Run a third-party command
  test      Run JavaScript and Solidity tests
  unbox     Download a Truffle Box, a pre-built Truffle project
  version   Show version number and exit
  watch     Watch filesystem for changes and rebuild the project automatically

See more at http://truffleframework.com/docs

1
  • hello! i installed command line tools for xcode, had already installed ganache, tried to sudo install everything but the result was the same. then i also installed it locally, and got the expected result that you wrote. when i go to the directory from finder, i can see everything there, BUT when i try to check the truffle version, and write a comment i get again 'command not found: truffle'... honestly, is there a way for me to pay someone to have access to my computer and fix this?? its getting ridiculous Commented Mar 14, 2021 at 10:17
0

There's homebrew which worked for me here

brew install truffle

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.