I'm getting an error for 'module' is undefined when I run 'truffle compile' from the project folder.
Any pointers to what might be going wrong? truffle init works fine and creates the project structure as described in the docs.
I'm a newbie to Truffle, so please let me know if I need to provide more info. Attaching the error screenshot

Just wanted to check if anyone can help on the above error. I hadn't been able to get to it for the last few days, but will be getting back to it later today... I need some help with the above error.
Thanks a lot for any input.
I am having the same issue. Same newbie status. Please help us!
Quick tweak :
-Find the file truffle.cmd
-Copy the file and rename it (e.g truf.cmd) (in the same repo )
-use truf compile
@vmadrien is right - what is happening is the OS is trying to run the truffle.js file when you type truffle compile, instead of running the truffle.cmd link to the node module that (for me) was in C:\Users\xxxx\AppData\Roaming\npm (it should also be on the Windows variable PATH so you can look there to find it too). Go rename that truffle.cmd file and you should be fine. Either that or rename the truffle.js file temporarily before running truffle compile in the project directory.
Interesting. As an alternative, you can always try Git for Windows, which provides the Git BASH terminal. It's guaranteed to work correctly there. https://git-for-windows.github.io/
I should have explained that tweak more :) Thanks @brendan87
This issue has been fixed on the Truffle master branch and will be released later this week (likely tomorrow). The README has been updated in two places that describe how you can avoid this issue in the future. Thanks for reporting!
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
Hi Guys,
Download the
Cygwin64 Terminal for windows
then run again truffle compile on truffle directory

When I rename the file, then I get the error "Could not find suitable configuration file" - is anyone else having this problem?
I am having this issue, just following the setup of the pet-shop (http://truffleframework.com/boxes/pet-shop), throwing this error when trying to truffle compile.
I'm on Windows 10 64bit.
@tcoulter If it was fixed, I seem to encounter a regression.
Also, the two links posted back in Aug last year are dead now.
I can go and manually rename the truffle.js as suggested, but it would be nice if that weren't necessary.
Ah, never mind. Found this in the current documentation:
http://truffleframework.com/docs/advanced/configuration#resolving-naming-conflicts-on-windows
WIN10 use PowerShell is OK
If you have the same issue on Windows, instead of truffle compile try truffle.cmd compile
not sure if this get resolved but you can always use truffle.cmd compile
Either use truffle.cmd compile or go to the /contract directory and use truffle compile .
Yep, using
truffle.cmd compile
worked for me!
Using truffle.cmd worked for me :)
While reading below helped as well
http://truffleframework.com/docs/advanced/configuration#resolving-naming-conflicts-on-windows
I had same problem on windows. But running it from inside the contracts folder worked without any issue.
in windows try ...
'truffle.cmd'
instead of 'truffle'.
Because of PATH_EXT= .......... .JS
truffle.js is excuted.
Or remove '.JS' in PATH_EXT .
I'm getting an error for 'module' is undefined when I run 'truffle compile' from the project folder.
Any pointers to what might be going wrong? truffle init works fine and creates the project structure as described in the docs.
I'm a newbie to Truffle, so please let me know if I need to provide more info. Attaching the error screenshot
This is an OS Conflict that may happen in some windows operation systems.
because windows wants to run truffle.js file instead of truffle.cmd.
you can simple solve this problem by using truffle-config.js file to keep the configuration (instead of truffle.js).
do not rename truffle.cmd and do not bring headache for yourself.
it's very simple. "keep the configurations in truffle-config.js file".
This could be issue with Windows Command Prompt; you can try with Windows Powershell, it worked like a charm for me:

Interesting. As an alternative, you can always try Git for Windows, which provides the Git BASH terminal. It's guaranteed to work correctly there. https://git-for-windows.github.io/
Thank you It helped me! for compiling but still get error while migrating.
Most helpful comment
If you have the same issue on Windows, instead of
truffle compiletrytruffle.cmd compile