-
Notifications
You must be signed in to change notification settings - Fork 62
contextify doesn't build properly with npm install #3
Comments
What's the actual error you're getting? *.node files are what C++ addons are compiled into, and that's the correct target of the require statement. If that file exists in default, the first require statement should succeed. The default vs. Release stuff is because node 0.4.x puts things in default, and 0.5.x puts things in Release. There's probably a way to control it with waf, but I haven't looked into it yet. |
I got linked to your StackOverflow question (http://stackoverflow.com/questions/7262251/npm-doesnt-build-contextify-release-node-path-not-found/7276320#7276320). If I'm understanding the question correctly, it looks like you're trying to build Contextify on one machine, then transfer it to another? That can be tricky, since Contextify is a C++ addon. You'll need to at least make sure that both machines are running the exact same version of node and are on the same architecture. I don't know if there are other factors that could cause incompatibility. Does Contextify build properly on the machine that you're trying to run it on? You can check out the git repository and run "node-waf configure build" in the base Contextify directory, and see if it compiles correctly. If you have nodeunit on that machine, you can run the tests with "nodeunit test/". |
That clears up a few things, thanks! - I have a local version of Centos that I can run the tests and build in - I'll update in a bit when I've finished that. |
Ok, so I tried the following: I installed a fresh version of node and npm on my CentOS test box, ran npm install, then commented out the try/catch, so that it would show me the error it was getting trying to include that gave me this error instead:
so, I tried backing up the node_modules folder, then running npm install - that gave me this error:
|
Also, I tried checking out and building and testing contextify. Here are the results of
and, the results of
|
Ok, so I'm not actually sure what fixed it, but I tried starting over again, and this time npm install went off without a hitch, and now contextify works fine - so the problem appears to be that I was compiling on a machine with a different architecture than the one I was deploying on. 🤦 Sorry for wasting your time... |
Glad you got things worked out. It wasn't a waste of time. The more info that's out there on potential issues and solutions the better. |
So, it didn't seem worthy of a pull request, but it may be helpful to note if the reason the 4.x.x version of contextify is not found, or if it has failed for another reason before checking for the 5.x.x version. I've added this to my local version of contextify, in place of lib/contextify.js: try {
module.exports = require('../build/default/contextify').wrap;
} catch (e) {
if(e.message.match('Cannot find module')){
module.exports = require('../build/Release/contextify').wrap;
} else {
throw 'Error: contextify was found, but does not appear to be built in this environment. Please rebuild contextify.';
}
} Let me know if you would like me to fork & pull request this. Thanks! Jesse |
Hey Jesse, That's a good idea with the extra feedback in contextify.js. I was able to fix the wscript file so contextify always builds to the Release folder, so I just pushed v0.0.5 with that fix, plus better feedback if the require fails. I thanked you in the commit log. Also, thanks for coming back and updating the issue - definitely appreciated. Brian |
the node_modules build folder now has:
.wafpickle-7 c4che config.log default
and the default folder has:
contextify.node src
note the package/build directory doesn't have a
Release
folder.the package sets up using this js:
it appears to be failing to find contextify, (the only file in the default folder is called
contextify.node
), then defaulting to theRelease
folder, which doesn't exist.The text was updated successfully, but these errors were encountered: