I am following this tutorial: http://truffleframework.com/tutorials/building-dapps-for-quorum-private-enterprise-blockchains.

I am trying to run truffle migrate on my project but it just opens my file in VSCode and nothing seems to happen. Any ideas what this problem is?

  • Are you using Windows? In such case I think it is because windows is trying to execute truffle.js, and it will open in visual studio code. If you are on Windows 10 I'll suggest to use the 'Bash on Ubuntu on Windows' instead. For other version use a virtual machine. Or if you know how to do it, use the full path to truffle.cmd.
    – Ismael
    Commented Jul 4, 2017 at 18:01
  • @Ismael yes I am on Windows 10. Thank you for this tip, I will try this soon
    – Evan
    Commented Jul 5, 2017 at 3:27

4 Answers 4


Since you are using windows it is because Windows is trying to execute the truffle.js file in your directory, and not the truffle command in your path. And since Visual Studio Code is associated with .js extension it will open it.

You can try with truffle.cmd. Or use the full path to truffle.cmd.

Also if you are on Windows 10 you can try 'Bash on Ubuntu on Windows' instead. For other versions you can use Ubuntu in a virtual machine.


Windows CMD automatically appends some 'know extensions' to files when trying to run them. In this case it's changing your truffle command to truffle.js (instead of ...\node\bin\truffle.cmd) because a Truffle.js file exists and .js is a 'known extension'.

CMD's 'know extensions' are stored in the PATHEXT environment variable, which in my machine contains: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

So, in my case, I just removed JS extension in the current console.


Or, I remove it system wide.


(Please note setx does not update already opened consoles until you restart them.)

  • This worked for myself followed by a restart. Commented Feb 21, 2018 at 9:39
  • This worked after I reopened the console -- no restart required. The best answer IMO.
    – ulu
    Commented May 6, 2020 at 8:45

Just use Windows PowerShell instead of Command Prompt.

enter image description here


Rename truffle.js to something else (truffle-bat.js) . And here are the answers form truffleframework.com 1. Call the executable file explicitly using its .cmd extension (truffle.cmd compile) 2. Edit the system PATHEXT environment variable and remove .JS; from the list of executable extensions 3. Rename truffle.js to something else (truffle-config.js) 4. Use Windows PowerShell or Git BASH, as these shells do not have this conflict. I chose the 3rd answers and solved my problem successfully.

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.