Package with binary npm dependency


#1

Hi,

I am making an unpublished package that uses exiv2 npm’s binary module. It used to work fine on my project, but when cloning my project on a new linux machine I get the following error, and noticed that the npm_modules directory is not created in my package directory, but present on my other linux machine.

I could copy npm_modules from my other machines, but I would appreciate to understand what is it I am doing wrong.

Below are the error I get and my package.js file.

W20150508-10:09:35.789(2)? (STDERR)           
W20150508-10:09:35.790(2)? (STDERR) /home/willdo/.meteor/packages/meteor-tool/.1.1.3.4sddkj++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
W20150508-10:09:35.791(2)? (STDERR) 						throw(ex);
W20150508-10:09:35.791(2)? (STDERR) 						      ^
W20150508-10:09:35.791(2)? (STDERR) Error: libexiv2.so.11: cannot open shared object file: No such file or directory
W20150508-10:09:35.791(2)? (STDERR)     at Module.load (module.js:356:32)
W20150508-10:09:35.791(2)? (STDERR)     at Function.Module._load (module.js:312:12)
W20150508-10:09:35.791(2)? (STDERR)     at Module.require (module.js:364:17)
W20150508-10:09:35.791(2)? (STDERR)     at require (module.js:380:17)
W20150508-10:09:35.791(2)? (STDERR)     at Object.<anonymous> (/home/willdo/meteor/@apps/gallery/.meteor/local/isopacks/williamledoux_lightroom/npm/node_modules/exiv2/exiv2.js:1:75)
W20150508-10:09:35.791(2)? (STDERR)     at Module._compile (module.js:456:26)
W20150508-10:09:35.792(2)? (STDERR)     at Object.Module._extensions..js (module.js:474:10)
W20150508-10:09:35.792(2)? (STDERR)     at Module.load (module.js:356:32)
W20150508-10:09:35.792(2)? (STDERR)     at Function.Module._load (module.js:312:12)
W20150508-10:09:35.792(2)? (STDERR)     at Module.require (module.js:364:17)

My package.js file looks like this:

Package.describe({
     ...
});

Npm.depends({
    "imagemagick": "0.1.3", 
    "exiv2": "0.4.1",
    "fibers":"1.0.1"
});

Package.on_use(function (api) {
    api.export('Lightroom');
    api.add_files("lightroom.js", ["server"]);
});

William.


#2

Maybe you need to install libexiv2 on your computer (like the error says).


#3

Whoops, Thanks for you reply. Though I still need some advice about the following steps that I had to do to make it work.

The error I got next was the following:

Error: Cannot find module './build/Release/exiv2.node'

The Release folder was indeed not created, and I had to build the exiv2.node module myself by executing node-gyp rebuild in the .meteor/local/isopacks/williamledoux_lightroom/npm/node_modules/exiv2 directory of my application.

So the question is: Is there a way I could embed the binary builds of this npm package in my meteor package so that users (and future myself) don’t have to follow those steps ?

William.


#4

So the question is: Is there a way I could embed the binary builds of this npm package in my meteor package so that users (and future myself) don’t have to follow those steps ?

When you publish a package with native dependencies, Meteor will prompt you a message that you need to build the package for each architecture by using the build machines. It’s the meteor build-for-arch <PACKAGE_NAME>@<PACKAGE_VERSION> command.

All npm packages that have a binding.gyp file are treated as npm packages with native dependencies.