0

Created Truffle project with truffle init. The project has two simple contracts written in Vyper. I configure the project's truffle-config.js to point at Ganache-UI.

Using truffle test, my contracts deploy to Ganache-UI and unit tests pass. I see the expected activity in Ganache-UI's transactions, blocks, and log tabs.

Because I'm learning to write Ethereum smart contracts, I want the extra runtime information Ganache-UI says I can get by linking it to my Truffle project. I added my truffle-config.js to a Ganache-UI workspace.

But when I run the Workspace and go to the Contract's tab, there are no contracts. Instead, there's an error message:

Could not find 'node'. Node.js is required to be installed to link Truffle projects.
Check the project configuration or try restarting Ganache.

I'm using:

  • ganache-ui: 2.5.4
  • macos: 13.1
  • truffle: 5.7.3
  • ganache: 7.7.3
  • solidity: 0.8.17
  • node: 18.8.0
  • web3.js: 1.8.1

The Ganache-UI error message is mystifying. Node is installed and works. Restarting Ganache-UI doesn't fix the problem.

How can I successfully link my Truffle project to Ganache-UI?


My truffle-config.js. Created by truffle init. Only change, uncomment developer network section and change port to my Ganache-UI's port.

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*"
    }
  },
  mocha: {  },
  compilers: { solc: {  version: "0.8.17"  }  }
};
5
  • Another possible cause of the issue could be the way you have configured the truffle-config.js file. It would be helpful if you could share the content of the file.
    – VX3
    Jan 27, 2023 at 17:13
  • Thanks for looking at my question. Added the config file contents.
    – devdanke
    Jan 27, 2023 at 18:14
  • It looks like your truffle-config.js file is configured correctly. The issue may be with Ganache-UI, specifically with its ability to find the correct version of Node.js. Try the following steps: Verify that you have only one version of Node.js installed on your system and check if it matches the version in Ganache-UI 'About' section Update the version of Node.js in Ganache-UI if it does not match Restart Ganache-UI and try linking the Truffle project again If the problem persists, try running Ganache-UI from command line or try different development environment.
    – VX3
    Jan 27, 2023 at 19:13
  • On MacOS, Ganache-UI has an 'About' page via the 'settings (gear)'. Also, MacOS provides an "About Ganache" menu item. Neither show Node version. I browsed my Ganache-UI's 'package contents'. I didn't see Node in those directories. I found only one Node installed (as expected) via homebrew, /opt/homebrew/bin/node.
    – devdanke
    Jan 28, 2023 at 6:08
  • FYI: I stopped using Ganache-UI. Now I just use ganache-cli. Also, I don't use Truffle any more because I didn't want its required contract versioning. Instead I directly use the native W3 clients for languages I work with: Web3J, Web3j, and Web.py.
    – devdanke
    Mar 20, 2023 at 13:49

1 Answer 1

0

Try this:

node -v
which node

To verify what version you're running

Run:

echo $PATH

To verify the path

If the issue still persists, you can try running Ganache-UI from the command line to ensure it picks up the correct environment variables:

open /Applications/Ganache.app/Contents/MacOS/Ganache

Replace "/Applications/Ganache.app" with the actual path to your Ganache-UI installation if it's different.

This command opens Ganache-UI with the same environment variables as your terminal session, so it should be able to find the installed Node.js.

If these steps do not resolve the issue, you can try reinstalling Node.js and Ganache-UI to ensure proper installation and environment variable setup.

2
  • My versions of Node (18.8.0) and Ganache (2.5.4) were listed in my question.
    – devdanke
    Mar 20, 2023 at 13:46
  • Have you gotten your Truffle projects to load into Ganache UI on Macos? If yes, what Node and Ganache-UI versions are you using? Thanks
    – devdanke
    Mar 20, 2023 at 13:46

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.