Try using truffle.cmd instead of just truffle. The CMD command-line is trying to run truffle.js which is in the current directory but this is not what you want!
Thanks a lot. It worked for me. I think it should be mentioned in their doc. :)
I ran into this issue, too. It would be a nice gesture to all the Windows users out there if the Truffle team would consider moving the configuration file to a subfolder, or renaming it to something other than truffle.
Hey guys, it looks to me like you guys are using the Command Prompt (i.e., cmd.exe). In my own testing, it appears as though the Command Prompt does have this issue. However, Windows PowerShell and Git For Windows (aka Git Bash) do not have this issue. Since the Command Prompt is such an old tool, I'm hesitant to support it.
However, I could be convinced to allow an optional truffleconfig.js, or similar, instead of truffle.js. Do you guys have a need for using the Command Prompt vs. the newer consoles?
I've added a feature where you can rename truffle.js to truffle-config.js for users who want to use the Command Prompt. If you rename the file, commands like truffle compile --all will provide the desired effects.
Commit here: https://github.com/ConsenSys/truffle/commit/e584f16088a04859ab20c3ee24019c375ad0314c
Will go out with the next release. This should be a sufficient enough solution given that there are many solutions (powershell, git for windows, truffle-config.js). Let me know if this doesn't cover most everybody's case.
Hi Tim, thank you for your prompt attention to this issue.
The fix that you've provided should resolve _my_ issue, because now I know that I can rename the file to truffle-config.js. But even with this fix in place, I'm concerned that this will still be a barrier-to-entry for Truffle users on Windows.
Consider: If a new Windows user is following the docs, then when they run truffle compile they will still encounter the same inscrutable error. If they're tenacious, they may Google the problem and find this bug report, but they may also just get frustrated and give up.
Have you considered swapping DEFAULT_CONFIG_FILENAME and BACKUP_CONFIG_FILENAME so that all new projects are created with "truffle-config.js" as the default? In theory, any existing projects would continue to work via the BACKUP_CONFIG_FILENAME mechanism, while any new projects would "just work" -- even for Windows users who are using cmd.exe.
I don't have any special attachment to cmd.exe but it's kind of the _de facto_ standard for Windows. After this, I probably will switch to using PowerShell -- but I doubt I'll be the last Windows user to try running Truffle through cmd.exe.
Hi Tim, Many thanks for your response !!!
As you have made changes regarding cmd.exe, i think if it will be mentioned in official documentation, it will be very useful for any new Windows user going to use Truffle.Whenever a new user will start work with Truffle, its official docs will be followed. So, there will not be any problem for anyone.
I've added two separate references of this issue to the documentation:
http://truffle.readthedocs.io/en/latest/getting_started/installation/#recommendations-for-windows
http://truffle.readthedocs.io/en/latest/advanced/configuration/#resolving-naming-conflicts-on-windows
Regarding switching the default configuration name, I'm not yet ready to do that, but I may do it automatically on Windows during truffle init. I'd rather promote users to upgrade to better consoles.
Thanks for your guy's feedback!
@tcoulter Yeah, it's fine to mention it in the doc. I hope this will guide users in a better way. Thanks.
I'd like to say that I've actually run into this issue today, and the link in documentation that's probably pointing to this conversion is broken and for a long time I couldn't understand what wasn't working. Could we just put the info inside the documentation instead of just linking?
On windows, removing '.JS' from the PathExt environment variable also solves the issue.
When truffle init works on Windows, and nothing does after that, you have to rename truffle.js to truffle-config.js in your project directory. Then, everything else will work. You need to do this for every project.
@tcoulter Still having this issue on Windows 10.
Had to rename truffle.js to truffle-config.js. Also, the links you mentioned earlier are missing (404).
Shouldn't the name of the file be changed to avoid these issues?
Finally: I'm using a quite advanced shell, wrapping cmd.exe. This is a common scenario on Windows and I dare to say it covers the vast majority of users.
@tcoulter Nevermind, I found your additions to docs:
http://truffleframework.com/docs/advanced/configuration#resolving-naming-conflicts-on-windows
Changing the name of truffle.js is only an improvement in my opinion, not an issue anymore.
BTW. Truffle is great!
Most helpful comment
Try using
truffle.cmdinstead of justtruffle. The CMD command-line is trying to runtruffle.jswhich is in the current directory but this is not what you want!