0

This question already has an answer here:

Am currently trying to learn Dapps, and trying to initiate Truffle. But, when I use the command "truffle console" in the Git CMD window, rather than opening the console, it opens up the 'truffle.js' file in my Adobe Brackets for editing. Not sure what to do here. Am attaching the images of the input and the output.

enter image description here

enter image description here

marked as duplicate by Ismael, Richard Horrocks, Crema, Achala Dissanayake, Malone Nov 8 '17 at 11:29

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

The problem is coming from the fact that Windows 10 tries to execute the truffle.js instead of running truffle.cmd. It must have some kind of native JavaScript engine that I haven't found yet how to disable.

Solution 1: Rename truffle.js to truffle-config.js

According to this article, the solution consist in renaming the file truffle.js to truffle-config.js.

Solution 2: Change command name

The solution consist in renaming truffle command to truff (for example) to avoid any confusion. For that, just go to C:\Users\{username}\AppData\Roaming\npm and rename 'truffle.cmd' to 'truff.cmd'.

Then you should be able to run truff version, truff compile and so on...

  • Hi Greg. Thanks so much. This seemed to have been the precise issue. I'd also been searching for the answer in the meantime, and got something similar from the truffle.readthedocs.io/en/beta/advanced/configuration which suggests the slightly different approach of changing the name of the .js file instead. Just noting it here for anybody who is facing this problem in the future. Thanks a lot again for taking out time and sharing your expertise which is so valuable for a beginner. Much appreciated. – Saiba Nov 1 '17 at 10:53
  • Hi, yeah didn't know about this alternative. I'm updating the answer – Greg Jeanmart Nov 1 '17 at 12:04

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