shama/nodewebkit

Can't install v0.9.2 (when specifying a version) as it tries to pull from Amazon S3

jamesmortensen opened this issue · 7 comments

When running the following command, the install script tries to install nodewebkit from Amazon S3, which was recently moved to dl.node-webkit.org:

npm install nodewebkit@0.9.2

I noticed you quickly fixed for the default version. If I try to pull in the dependency without specifying a version, the installer pulls from the new location.

Thus, the problem exists only with the cases where you specify a version.

Try npm install nodewebkit@0.9.2-4 to get the latest version of 0.9.2.

Hey,

Just FYI, specifying the 0.9.2-4 did download the right version, but for some reason it won't run. If I download the same ZIP file from the node-webkit site manually, it works.

I don't have the exact error message, as I temporarily gave up and just wrote my own script to pull this stuff down, but I would of course prefer to use a module since writing one's own install scripts is considered an anti-pattern.

Is there any way you can test this stuff out on 0.9 branch as well? I also think it needs to be more clear in your documentation that the -4 is required.

As an aside, if you're not able to replicate, please let me know and I'll make time to get you what you need.

Thanks and hope this helps!

What error do you get? Does it say "Field 'main' is required." by chance (as there is a known issue with node-webkit that looks for the wrong package.json ref #22)?

I'll update the docs about meta version with npm. Thanks for your help!

Hello,

Yes, that's the error I get. Although, as a troubleshooting step I downloaded the actual node-webkit without this package, and I placed it in the node_modules folder, and it works. I suspect maybe the postinstall script might be doing something with permissions maybe? But that's just a guess...

 "start": "node_modules/node-webkit/node-webkit.app/Contents/MacOS/node-webkit ."

I download 0.9.2, the same version the postinstall script tries to download. If I put the above in my app package.json, I can use npm start to run the app, and it doesn't complain.

I really think that what you put together is a useful part of the core node-webkit. This makes it so much easier to wire in node-webkit as a dependency so it's easy for others to get everything they need with a simple "npm install". Hope this helps!

After installing with npm install nodewebkit@0.9.2-4 could you rename node_modules/nodewebkit/package.json to node_modules/nodewebkit/package_backup.json and then give it a try?

It sounds like this issue is nwjs/nw.js#1503 The downloaded archive doesn't contain a conflicting package.json file. We need one here for the npm package though.

FWIW, I've been thinking about renaming the package.json after installing to work around that issue but it will likely screw up npm. So looking into a fix on node-webkit itself is probably the best plan.

Is it possible for you to put your binary in a subfolder? Since we're not actually using nodewebkit with require and are in fact just using the binary itself, would changing the package structure help? NOTE: I just tried running the other nodewebkit binary in the Contents/MacOS folder, and same result, it fails with the 'field main required' error message.

I did rename the package.json to something else, and then both binaries in your module worked as expected.

I'm no expert here, so this is just an idea, but what if you had your scripts install nodewebkit to a separate folder in the node_modules folder, sort of like what I did by manually downloading it? Your package.json would still be in place, and there wouldn't be a conflict, right? Again, I'm no expert, and this does sort of sound like a hack, so if this is a bad idea that's fine; my hope is that it helps you land a better idea, which may of course just involve seeing if Roger can fix it in the core. :) Hope this helps!

Upon running the bin, it will rename it's own package.json and rename it back shortly after. Not the best solution but it will work until that issue is fixed in node-webkit. Also added a note about the versioning.