Closed rtvs16 closed 8 years ago
I'll give you an example bb-file in a moment, but first I'll have to ask:
Why are you packaging node-bindings to a globally installable OE package?
Why I am asking:
Usually npm-install
is used for complete application that gets bundled and packaged with all its node_modules cross-compiled and included for embedded deployment. Another good examples are command line utilities such as grunt-cli
, bower
or forever
.
Packaging each and every dependency module separately is not what I'd recommend for deploying Node.js based software.
It's this simple:
node-bindings_1.2.1.bb
SUMMARY = "Helper module for loading your native module's .node file"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://README.md;beginline=73;md5=c9dbec5380fde616b6393b2b1d91cd18"
SRC_URI = "https://github.com/TooTallNate/node-bindings/archive/v${PV}.tar.gz"
SRC_URI[md5sum] = "f2a1591fc44434405f8e5c5622ab8d37"
SRC_URI[sha256sum] = "1fe30d614f6971cc5ab1ecee0edbf95d96d3abe9386a71f5fcad9fcc15bc3c24"
inherit npm-install-global
First thank you very much for your help. In regards of your question, the motivation is to provide an out-of-the-box set with the necessary modules and not worrying about 2d or 3rd installations. I agree with you that using npm is another option (and probably better), nevertheless I see better responses from the users when the packages are included.
I gave a try to your suggestion and unfortunately did not work . It is showing similar errors of what I had before
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -2
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.
npm verb exit [ -2, true ]
...
ERROR: oe_runnpm failed
Note:
Installing the package using npm on the target works fine. The fine print is that the environmental variable NODE_PATH is not defined, so the search for modules sometimes fails.Tthis situation can be corrected adding it to /etc/environment
Did you really replace your recipe with the one that I provided?
Reason your original recipe did not work was that it had S = "${WORKDIR}/git
which pointed the S
to wrong directory.
Also you skipped configure
step and compile
step for no reason.
I was able to build proper node-bindings
package with above recipe.
Yes I did, it is exactly as yours in content.
I figured it out.... the recipe name had a missing s mine -> node-binding_1.2.1.bb yours -> node-bindings_1.2.1.bb
My bad on that, sorry; and again thanks for your help!
Glad the issue resolved. I named the recipe after original node module.
Closing this as resolved.
I'm soon releasing a separate layer for Node.js bb recipes which will include lot of examples.
Hi,
I have been trying to add to my image a nodejs package without success. I looked around and I couldn't find an answer, so perhaps this questions could help others.
I am trying to add node-bindings to my image as follows: Create a file called -> bindings_1.2.1.bb
The log reads
Could you provide some hints / directions on how to install a package / write a recipe ?