zooniverse / wildcam-gorongosa

http://www.wildcamgorongosa.org
Apache License 2.0
2 stars 6 forks source link

Can't compile app on Windows machine #223

Closed shaunanoordin closed 8 years ago

shaunanoordin commented 8 years ago

Issue(?): running npm start on a Windows 10 machine with Git Shell will result in an error, preventing the app from compiling.

Analysis:

ERROR in ./app/partials/footer-logo.cjsx
Module not found: Error: Cannot resolve 'file' or 'directory' ./../../node_modules/webpack/buildin/module.js in C:\projects\wildcam-gorongosa/app\partials
 @ ./app/partials/footer-logo.cjsx 1:0-57

So all this time, I've been running wildcam-gorongosa on my office Macbook, and it's been compiling/running fine. At this moment though, I'm running WG from my Windows 10 Surface Pro 3 Machine with Git Shell, and when I try to compile/run the app I receive the above error.

A quick trace revealed that in app/partials/footer-logo.cjsx there's this line of code...

module?.exports = React.createClass

that when changed to...

module.exports = React.createClass

will fix my Windows-specific issue.

I was able to properly test #222 by temporarily removing the ?, but I'm curious to know why module?.exports exists, and only specific to footer-logo.cjsx. I have no idea what the modules?. does in this context as my Coffee-Fu is weak. (It's decaf, really.) @srallen , do you have any insights into this?

srallen commented 8 years ago

? is the existential operator. In this case it is checking if module, a reference to the current module, isn't null or undefined. I'm not sure what the specific potential error it may be checking against, but it was the coding style of a previous developer, and he contributed that component to Wildcam when it was being developed. As to why Windows fails to compile it... I have no idea. IMO, it's not necessary and can be removed.

shaunanoordin commented 8 years ago

Thanks @srallen! Looks like we've got an operator that maybe shouldn't be there... perhaps this is an existential crisis. I saw the comments made by @brian-c in PFE issue 2775 too, so I've pushed a similar #224 to get rid of ?.