How to do it...

The Node.js package is available in the meta-openembedded layer. To add it to our image we just have to modify either the image recipe or our conf/local.conf with the following:

IMAGE_INSTALL_append = " nodejs" 

After building our image of choice, for example core-image-minimal, we can check that Node.js is correctly installed with the following command:

# node --version
v8.4.0

We are also able to open the Node.js Read Eval Print Loop (REPL) interactive JavaScript prompt with the following command:

# node

To exit, press Ctrl + D.

To install npm to the target image, add the following to either your image file or conf/local.conf file:

IMAGE_INSTALL_append = " nodejs-npm" 

After building and programming the image, we are now able to search for packages with the following:

# npm search <package>

We can install them locally with the following command:

# npm install <package>

Alternatively, we can install them globally with the following command:

# npm install -g <package>
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset