MEDIATEK LinkIt Smart 7688 Developer's Manual page 33

Hide thumbs Also See for LinkIt Smart 7688:
Table of Contents

Advertisement

In the vi editor, type letter i to insert code. Type the codes below.
3)
console.log('Hello World');
Save the file and exit the vi editor:
4)
a) Press the esc key
b) Press :wq!
Execute the example code by typing the command:
5)
node app.js
You should see Hello World as the output string.
3.8.2. Installing additional packages in Node.js
Node.js comes with a default package manager utility called npm. You can use this utility to install
additional Node.js modules. To use it, first make sure your board is connected to the internet as
described in section 4.6.5, "Connecting LinkIt Smart 7688 to a Wi-Fi Access Point To Access
Internet" or Get Started guide, and check
install command in the system console to install the packages. For example:
npm install request
This installs the popular
Note some NPM packages that rely on native C/C++ implementation may fallback to pure
JavaScript implementations or fail to install at all because there isn't native compilation
toolchain environment available on the board, specifically, the node-gyp. For example, when
installing the socket.io package, you'll see a warning message during the installation process, as
shown below:
sh: node-gyp: not found
npm WARN optional dep failed, continuing utf-8-validate@1.2.1
This is because socket.io relies on other packages such as utf-8-validate and bufferutil that
require node-gyp to build their native implementations. These are optional dependencies to
socket.io package, so eventually the package installs and you can still use it with some
limitation. But for some packages that require native implementations, they may fail to install at
all.
This document contains information that is proprietary to MediaTek Inc.
Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.
MediaTek LinkIt™ Smart 7688 Developer's Guide
for a list of available packages. You can use npm
here
request
package, which helps you generate HTTP requests easily.
© 2015, 2016 MediaTek Inc.
Page 33

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents