reactioncommerce / reaction

Mailchimp Open Commerce is an API-first, headless commerce platform built using Node.js, React, GraphQL. Deployed via Docker and Kubernetes.
https://mailchimp.com/developer/open-commerce/
GNU General Public License v3.0
12.3k stars 2.17k forks source link

Windows incompatibility/compile issue #363

Closed taylorsmithgg closed 9 years ago

taylorsmithgg commented 9 years ago

W20150409-11:48:47.530(-4)? (STDERR) W20150409-11:48:47.532(-4)? (STDERR) C:\Users\tsmith\AppData\Local.meteor\packages\meteor-tool\1.1.3\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fibers\future.js:245 W20150409-11:48:47.532(-4)? (STDERR) throw(ex); W20150409-11:48:47.532(-4)? (STDERR) ^ W20150409-11:48:47.532(-4)? (STDERR) Error: %1 is not a valid Win32 application. W20150409-11:48:47.532(-4)? (STDERR) W20150409-11:48:47.532(-4)? (STDERR) C:\Users\tsmith\AppData\Local.meteor\packages\npm-node-aes-gcm\0.1.3_6\npm\node_modules\node-aes-gcm\build\Release\node_aes_gcm.node W20150409-11:48:47.532(-4)? (STDERR) at Module.load (module.js:356:32) W20150409-11:48:47.532(-4)? (STDERR) at Function.Module._load (module.js:312:12) W20150409-11:48:47.532(-4)? (STDERR) at Module.require (module.js:364:17) W20150409-11:48:47.533(-4)? (STDERR) at require (module.js:380:17) W20150409-11:48:47.533(-4)? (STDERR) at Object.Npm.require (C:\Users\tsmith\WebstormProjects\chaos-box.meteor\local\build\programs\server\boot.js:142:18) W20150409-11:48:47.533(-4)? (STDERR) at Package (packages/npm-node-aes-gcm/wrapper.js:2:1) W20150409-11:48:47.533(-4)? (STDERR) at C:\Users\tsmith\WebstormProjects\chaos-box.meteor\local\build\programs\server\packages\npm-node-aes-gcm.js:33:4 W20150409-11:48:47.533(-4)? (STDERR) at C:\Users\tsmith\WebstormProjects\chaos-box.meteor\local\build\programs\server\packages\npm-node-aes-gcm.js:42:3 W20150409-11:48:47.533(-4)? (STDERR) at C:\Users\tsmith\WebstormProjects\chaos-box.meteor\local\build\programs\server\boot.js:222:10 W20150409-11:48:47.533(-4)? (STDERR) at Array.forEach (native)

aaronjudd commented 9 years ago

Looks like a duplicate of #359?

aaronjudd commented 9 years ago

from gitter @taylorsmithgg:

is an issue I've been having lately on a windows platform. Not a major concern, but it would be nice to have the support. Ran into similar issues with using demeteorizer on Mac, had to manually update the corresponding packages (bcrypt,node-aes-gcm, node-gyp) to the latest versions to get it operational. No such luck on Windows so far.

taylorsmithgg commented 9 years ago

Probably of similar nature if not the exact same. Just figured I'd throw it there for reference.

kpatyal commented 9 years ago

I am getting same error, have you got any solution?

jenskastensson commented 9 years ago

I'm interested in Windows support too, having the same issue.

kifirkin commented 9 years ago

It looks like this issue from meteor https://github.com/meteor/meteor/issues/4087

kifirkin commented 9 years ago

btw also I've noticed that my app wich uses only core package of reaction works without errors. It was cloned from reaction at early versions

mpaezmolina commented 9 years ago

Hi, is there any updates on this issue? We are really looking forward to run Reaction on Windows. Thanks!

aaronjudd commented 9 years ago

just purchased an actual windows machine, so that we can test and debug windows. stay tuned please.

aaronjudd commented 9 years ago

I’ve made it past all the obvious things (you need to install openssl manually - updated docs with details on this) - so that meteor actually starts correctly now, but there’s still 1 more error that’s crashing meteor with a windows only bug in reaction-core, and frankly I’m stumped because the debug/tracing from meteor doesn’t show any clue as to the root cause event.js:72.

abhisheksoni27 commented 9 years ago

Is there any progress to this bug? I cant start developing on reaction because of this. When can we expect this to be resolved?

aaronjudd commented 9 years ago

Still getting an error related to node-aes-gcm, even though openSSL is installed.

)                                            throw(ex);
)                                                  ^
) Error: The operating system cannot run %1.
)
) C:\Users\Aaron\AppData\Local\.meteor\packages\npm-node-aes-gcm\0.

)     at Module.load (module.js:356:32)
)     at Function.Module._load (module.js:312:12)
)     at Module.require (module.js:364:17)
)     at require (module.js:380:17)
)     at Object.Npm.require (C:\Users\Aaron\Documents\Projects\reac
)     at Package (packages/npm-node-aes-gcm/wrapper.js:2:1)
)     at C:\Users\Aaron\Documents\Projects\reaction\.meteor\local\b
)     at C:\Users\Aaron\Documents\Projects\reaction\.meteor\local\b
)     at Array.forEach (native)
)     at C:\Users\Aaron\Documents\Projects\reaction\.meteor\local\b
abhisheksoni27 commented 9 years ago

I am getting the eventsjs:72 error on Windows 8.1 . Maybe Windows 10 might be able to look into this?

aaronjudd commented 9 years ago

@abhisheksoni27 can you try:

- download and install Python 2.7.x for Windows 
- download, install Visual Studio Express 2013
- install node.js version 0.10.36 for Windows 
- install the Visual Studio 2008 redistributable required by OpenSSL for Windows.
- download and install the Windows binary OpenSSL distribution. 

in theory you should be able to run: npm install node-eas-gcm at this point, and this might let you past the event.js stage, and past my error. Maybe -- but I'm having problems getting this compiled correctly, but maybe somebody more comfortable with windows can solve this.

@i-a-n I hear you are windows friendly, any chance you can help debug this?

abhisheksoni27 commented 9 years ago

@aaronjudd I am going to try that and I will let you know.

abhisheksoni27 commented 9 years ago

I tried that and it still did not work. Maybe, we could post this on a windows specific forum so that they might have abetter idea as to what is going on? Or a version specific Node forum?

Also, has this project ever worked on windows? That could help us out too.

aaronjudd commented 9 years ago

imagemagick/graphicksmagic isn't required to run Reaction (though you'll get a message warning that you should install it). I'm not sure Reaction ever compiled on Windows as we only started attempting with Meteor release 1.0. I seem to remember someone saying that they had earlier Reaction versions running, but that could mean any number of dependencies also would have changed. We could try running just core, and removing packages from package.js until we at least have meteor running - that could help identify a particular culprit - but the issues I've worked through so far were all Meteor related.

abhisheksoni27 commented 9 years ago

So, what next? Because VirtualBox is fine, but is not the best bet. Also, I removed all packags, and used the basic accounts, and reaction packages, and it still throws the same error.

On Node Specific forums, however, like on SO, it was mentioned that thi error is only thrown when the port node wants is already taken, which completely doesnt make sense in this case, but it might throw some light.

And Maybe, it is about time testing packages, other than core, in projects other than reaction and see if they some damage over there. What do you reckon?

aaronjudd commented 9 years ago

I've spent most of the day trying to debug the event.js error and I'm just not getting anywhere. I'm out of ideas and need to move on. I'd really like to have this fixed - as it's one of the blockers for 0.6.0 release. Happy to offer a bug bounty for resolution (anything will be less painful than trying to debug this!)

jmonte407 commented 9 years ago

I was hoping this got resolved also.. We only use windows machines here... This looked like a good project for us to get started with .. anyone know any other projects like reaction? We want to use meteor for our full stack and get rid of .Net.. ASP.Net etc..

aaronjudd commented 9 years ago

@jmonte407 really this "should" be working.. as in I really feel like this is a Meteor problem - you're not cross platform unless you actually work the SAME across platforms. ;-) - there's a couple issues related to this on the Meteor repo, but I'm going to see if we can escalate / see if the wider meteor community can solve.

jmonte407 commented 9 years ago

Wow.. Thanks for the response Aaron... I go to many meetups.. we discuss many things related to meteor.. Many of the users have used reaction "Linux users" these users make up about 20% of the users at these meetups.. The rest of us "Windows users - 60 or 70%" in the crowd just sit there saying.. "Has anyone got it to work in Windows"... Reaction looks like a good project... and I agree, should be cross platform....

kifirkin commented 9 years ago

Hi! I'm trying to manually rebuild node-aes-gcm module with node-gyp rebuild, and what I've got, is that error changed to %1 is not a valid win32 application :sob: Also I had to install Win64OpenSSL-1_0_2d.exe

kifirkin commented 9 years ago

So I switched to 32bit version and got no results: rebuilding node-aes-gsm does nothing events.js:72 throw er; // Unhandled 'error' event But I think the problem is there

aaronjudd commented 9 years ago

@kefirchik I was able to get that far as well - from my research that error comes from node when it tries to "spawn" a new process, and has a failure. I've seen some pretty complicated debug info out there: http://stackoverflow.com/questions/27688804/how-do-i-debug-error-spawn-enoent-on-node-js (for instance). However, that's not a task I can really take on right now (and keep everything else moving forward). Meteor itself is working "fine" in the sense that a freshly created project works fine. I've stripped out all the other packages and testing with just reactioncommerce:core the error appears. I started taking out dependencies to test, but that was a mess. So clearly, the cause is somewhere in our code, or a dependency - but how to debug from here without spending weeks on it? ....

jmonte407 commented 9 years ago

Wish I knew more about Linux... wish our company would let us use Linux machines... because this project would have gotten us off to the races in no time... we are still going to use the meteor stack.. does anyone know any other projects similar to reaction?

kifirkin commented 9 years ago

So, after following StackOverflow answer I came up to put a wrapper function for debugging childProcess.spawn inside main.js file in bundled version of reaction and that is wat it gives me:

spawn called
{ '0': 'C:\\homework\\bundle\\programs\\server\\npm\\ongoworks_bunyan-logger\\node_modules\\bunyan\\bin\\bunyan',
  '1': [ '-o', 'short' ],
  '2': { stdio: [ null, [Object], [Object] ] } }

wrapper:

(function() {
    var childProcess = require("child_process");
    oldSpawn = childProcess.spawn;
    function mySpawn() {
        console.log('spawn called');
        console.log(arguments);
        var result = oldSpawn.apply(this, arguments);
        return result;
    }
    childProcess.spawn = mySpawn;
})();
kifirkin commented 9 years ago

@jmonte407 Nope, reaction is still the only actually mature ecommerce system written with Meteor

jmonte407 commented 9 years ago

We need something to get us off and running fast... Sencha ExtJS has come up in conversations.. It looks cool.. however, it's not free...

kifirkin commented 9 years ago

Finnaly I've get it working on Windows :sweat_smile: I've just remove ongoworks:meteor-bunyan and commented all of ReactionCore.Events code and it works for me now!

Next, I'll try to figure out what exactly in bunyan causes this error.

jmonte407 commented 9 years ago

Wow.. Nice job kefirchik... You've got better debugging skills than us... at least it's narrowed down to certain areas... I see light at the end of the tunnel:)

kifirkin commented 9 years ago

Yeah Thanks! I've got it out! So... The problem is here in server/app.coffee:

ReactionCore.Events = logger.bunyan.createLogger(
  name: "core"
  serializers: logger.bunyan.stdSerializers
  streams: [
    {
      level: "debug"
      stream: (unless isDebug is "DEBUG" then logger.bunyanPretty() else process.stdout )
    }
  ]
)

logger.bunyanPretty() cause the error, and basically I think it's because bunyan-pretty has no windows binary. And there is no source on github for this package. Also I found another package for pretty-printing bunyan-prettystream

For more details check out https://github.com/trentm/node-bunyan/issues/13

kifirkin commented 9 years ago

I've just checked it twice on fresh install and changing stream: (unless isDebug is "DEBUG" then logger.bunyanPretty() else process.stdout ) to stream: process.stdout works fine :smile:

jmonte407 commented 9 years ago

Nice!!! ... We'll wait for new build of reaction.. none of us know coffee script... but i'll paste your code into app.coffee and see what happens:) hopefully aaronjudd and other guys see your fix soon .. I know at least 7 other programmers that will be happy when this gets working on windows:)

kifirkin commented 9 years ago

You are welcome :+1: After you get reaction working, please, confirm it here :smile:

jmonte407 commented 9 years ago

hmmm.. I dont even see a server/app.coffee .. I have server/fixtures.coffee and server/polocies.coffee.. no app.coffee...

aaronjudd commented 9 years ago

@kefirchik :+1: nice work!! I can't test until I get into the office, but can update and rollout out some updated packages when I get there this morning. Have you tested bunyan-pretty-stream?

aaronjudd commented 9 years ago

@jmonte407 re: not knowing coffeescript - no worries - we're going to be switching to ES6 for Meteor 1.2. Just hang in there for a bit.

jmonte407 commented 9 years ago

Wow.. what a great group here... You guys rock!!!

jmonte407 commented 9 years ago

After new roll out... I'll let you know if it worked... :)

kifirkin commented 9 years ago

@jmonte407 I forgot, actually server/app.coffee is in reaction-core :smile:

jmonte407 commented 9 years ago

ok...

abhisheksoni27 commented 9 years ago

So, @aaronjudd, have you committed the changes to the core package?

jmonte407 commented 9 years ago

hmmm.. obviously we dont know what we are doing with reaction... we only cloned reactioncommerce.. do we need to clone .core then commerce ? not sure how this all works...

kifirkin commented 9 years ago

you can make folder packages inside reaction, and clone reaction-core there. Meteor will pick local package instead of downloading from atmosphere

abhisheksoni27 commented 9 years ago

@kefirchik : Maybe you could issue a pull request with the changes you did to the reaction:core pacakge?

kifirkin commented 9 years ago

yes, I've just created https://github.com/ongoworks/meteor-bunyan/pull/4

kifirkin commented 9 years ago

@aaronjudd It seems to work now with bunyan-prettystream, but maybe I missed something: after reset, I can't see demo login credentials in console :worried: Is this related?

jmonte407 commented 9 years ago

so starting for scratch.. i've been doing git shell c:\git clone https://github.com/reactioncommerce/reaction.git c:\reaction

Should I be doing core first? then create packages folder and clone commerce? Do I need to clone to c:\reaction\packages ?

abhisheksoni27 commented 9 years ago

@kefirchik No. That is not related. I have never seen the credentials in the console since I begin working with this package. As a matter of fact, your username might be, by default, youradmin@yourdomain.com and password is password.