-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Build: Add v8 specific platform builds #148
Conversation
Looks good, I'll have a play around with this over the next few days. Thanks! |
I excluded the binaries from the repo, but maybe you do want to include them. I just figured it would be nicer for the git repo size. |
I think we do want to include them, but obviously they will need to be renamed. |
Hey, I’m just curious how this worked on your end, @nschonni. I added the binaries back in and renamed them correctly. With your additions, Node-sass finds them successfully, but they still seem to rebuild anyway:
Do the binaries themselves need to be updated with this change? They still get rebuilt even if I use the binary Node-sass itself just built. We’re really looking forward to this feature so we can add Node-sass to Harp. I’m happy to test it out more if that would help at all—it’s also entirely possibly I’m doing something wrong here. Thanks for your work on this! |
The check now runs the full test suite to see if the binary is OK before trying to rebuild. If there are any bugs in the build, it should probably check again at the end. |
I think there may be an unrelated |
What platform is this on? I'm not getting any failures on mac os x or travis. |
I rebased over the latest to include the CLI test fixes that were added in after |
I’m using OS X 10.8.4 with Node 0.10.18. Thanks for the update, all the tests are passing, including the new ones. The same thing is still happening as before, but maybe I’m misunderstanding what should be happening? I expected when I run What actually happens is the binary is found, but there is a |
You're right, there is a problem with the mocha test snifffing that it is doing right now |
Is there anything information I could provide or testing I could do that would help resolve that? |
The spawning and testing of the mocha return here https://github.com/andrew/node-sass/pull/148/files#L1R34 needs to be fixed. |
There is undoubtably a cleaner way to do this, but I believe I got it working here. You can |
OK, I think I found a fix courtesy of http://ronderksen.nl/category/mocha-js/. |
So the goal would be to run all the tests, and |
Yeah, I'm not sure what the one in the root is used for. |
@nschonni Good find, that post worked for me. https://github.com/kennethormandy/node-sass/blob/node-gyp-build-like-fibers/build.js |
I did push a working version to this PR, but I did not include all the tests since the CLI test consistently fail for me on Windows. |
I totally missed that, thanks. Like you said, your version worked on Windows 8, whereas mine didn’t. I got this issue on Windows 7 for both, though. C:\Users\IEUser\Documents\GitHub\node-sass [node-gyp-build-like-fibers]> npm ins
tall
> [email protected] install C:\Users\IEUser\Documents\GitHub\node-sass
> node build.js
C:\Users\IEUser\Documents\GitHub\node-sass>node "C:\Program Files\nodejs\node_mo
dules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYT
HON env variable.
gyp ERR! stack at failNoPython (C:\Program Files\nodejs\node_modules\npm\nod
e_modules\node-gyp\lib\configure.js:118:14)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\node
-gyp\lib\configure.js:81:11
gyp ERR! stack at Object.oncomplete (fs.js:107:15)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modu
les\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\IEUser\Documents\GitHub\node-sass
gyp ERR! node -v v0.10.18
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok
Build failed
npm ERR! weird error 1
npm ERR! not ok code 0 That said, I actually can’t install the latest version of Node-sass on Windows 7 (v0.6.4 seems to work better) so maybe that issue isn’t here. module.js:340
throw err;
^
Error: Cannot find module 'mocha'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\Users\IEUser\Documents\GitHub\node_modules\node-sa
ss\build.js:5:10)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
npm ERR! weird error 8
npm ERR! not ok code 0 |
|
Ever since you included the binaries (thanks!), I imagine it would work exactly the same on npm. If I I don’t know if that’s helpful, but it seems something with node-gyp needs to be deferred until the build is triggered. Maybe that means we have to use a different method to check if the binary exists. |
@kennethormandy Thanks! I've moved Mocha and bumped the dependency. I did run into a file locking issue once during the rebuild, but haven't been able to reproduce it again. I think @andrew may add back in the binaries again, or just include them during the NPM publish. |
I haven’t tried it yet myself, but it seems like #160 should help out here? |
Whoops, merge conflicts now. I'll rebase and see if it goes green on Windows |
I've rebased, but I still need to re-check on Windows |
I’m hitting the Python issue on Windows 7 & 8 now. So at least they’re doing the same thing, that seems positive. Entirely likely I’m misunderstanding, but since the binaries are already there (I’ve cloned your repo and am just running I also had updated this and hit the Xcode license agreement warning, which I don’t think should have happened since we it shouldn’t have needed to rebuild. Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
gyp: Error 69 running xcodebuild
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:424:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 12.4.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" Once I agreed, I’m hitting this error on OS X, which I’ve seen before. I believe I got around it here, but I could be mis-remembering. Something in test.js had an extra line break or something weird like that? And it seems like it was causing this to happen. Anyway, this is the error with CXX(target) Release/obj.target/binding/binding.o
In file included from ../binding.cpp:7:
../sass_context_wrapper.h:1:10: fatal error: 'libsass/sass_interface.h' file not found
#include "libsass/sass_interface.h"
^
1 error generated.
make: *** [Release/obj.target/binding/binding.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 12.4.0
gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
|
Did you do |
Btw, because you need visual studio on Windows, it would be preferable having the bindings in the repo to not force everyone to rebuild. |
Prepublish hook sounds good |
👍 |
@andrew I made a very lazy prepublish hook that assumes you have cloned |
How is that going to work on travis? Do we need to add a bit of setup script to |
Not sure why it is trying to run the |
Ah, from the NPM docs https://npmjs.org/doc/files/package.json.html
Guess it does need a guard of some kind 😦 |
Can you move the prepublish code into it's own script then we can check and maybe even curl the specific binary directly from github rather than needing the whole repo locally? |
Idea courtesy of node-fibers. When installing, check to see if there is a compatible binary version for the current version of v8. v8 3.6 = Node 0.6, 3.11 = Node 0.8, 3.14 = Node 0.10. The test suite is run as well, so that any underlying libsass breaks will be rebuilt. Closes sassgh-146
Done, I think the curl idea is good, but it can be tackled separately. |
Looks good, is there anything stopping me from merging this? |
As much as I’m looking forward to this being merged, I think you should just be able to install Node and I don’t think that will be the case with Windows. It’s still possible I’m doing something wrong, but I think way the binaries are being checked makes Python a requirement for installing this on Windows. If someone who doesn’t have Python on Windows has tested this successfully, then I would be happy to see this merged, as it’s probably me messing up. But so far I haven’t been able to do it successfully myself. @andrew Never mind. I manually Edit again I did find one issue. Something is wrong with one of Mocha’s dependencies’ |
@kennethormandy the NPM install will include the binaries when it is published. Python is only a requirement if the tests fail and a rebuild is required.
Can you give specific steps to reproduce the issue?
@andrew I think I'm finally finished 😄 depending on whether @kennethormandy's problem can be reproduced, I think it is good to go. |
@nschonni Yep, I submitted a pull request against yours which solves the problem, but I’m not sure if it’s the best way. Commander v0.6.1’s |
Let's get it merged in now and we can start kicking the tyres before shipping it. Thanks @nschonni, excellent work! |
Build: Add v8 specific platform builds
I just pushed out v0.7.0-alpha and installed it and it all worked great, you can get it with:
If someone can give that a try on windows and see if it works that would be very handy, then we can 🚢 |
@andrew This is great, it worked exactly as I would have expected on Windows 8 and OS X. On Windows 7, I’m still getting and unexpected token in the package.json error for commander v0.6.1, which mocha is using. Using any higher version of commander seemed to fix the problem, so I added shrinkwrap file: nschonni#2. This fixes the problem on Windows 7, but there might be a better way to solve it that I’m unfamiliar with. |
@kennethormandy do you mind creating a new issue for the commander issue and maybe including the console output (or in a Gist if it's long)? |
@kennethormandy I guess we wouldn't be able to get @visionmedia to upgrade commander in mocha, but I've sent a pull request anyway: mochajs/mocha#1010 The only thing with shrinkwrap is that it locks down all the dependency versions, meaning we'll never get any bug fix releases unless we manually update the shrinkwrap. Can you try pointing mocha to my fork and see if that helps on windows 7:
|
@andrew Ugh, sorry. Good news, this was totally my fault. It was just a caching issue with npm. Thanks for the work on this everyone! |
🤘 |
Just published this as v0.7.0: https://github.com/andrew/node-sass/releases/tag/v0.7.0 |
Idea courtesy of node-fibers.
When installing, check to see if there is a compatible binary version for the current version of v8. v8 3.6 = Node 0.6, 3.11 = Node 0.8, 3.14 = Node 0.10. The test suite is run as well, so that any underlying libsass breaks will be rebuilt.
Closes gh-146
I added the
console.log('Please consider contributing the release binary to node-sass for npm distribution.');
line, but you'll have to figure out a method for accepting binaries to include (DropBox, etc...). Alternately you could create anode-sass-binary
repo for accepting PRs.