This question already has an answer here:

I am trying to run truffle commands on commandline but it brings up the code file instead

like this

Like this

marked as duplicate by Ismael, ivicaa, Richard Horrocks, Achala Dissanayake, Roman Frolov Mar 5 '18 at 19:48

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.

  • Try to run it from an other directory of your project (not from the directory where your truffle.js is) – Florian Castelain Jan 25 '18 at 4:57
  • @Andromelus this happens after I uninstalled and installed truffle C:\Users\user>npm install -g truffle C:\Users\user\AppData\Roaming\npm\truffle -> C:\Users\user\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js + truffle@4.0.5 added 91 packages in 21.825s C:\Users\user>truffle version 'truffle' is not recognized as an internal or external command, operable program or batch file. – ethereumnoob Jan 25 '18 at 8:15

Browse other questions tagged or ask your own question.