27.7.2. Node.js
Host installation shown at: https://askubuntu.com/questions/594656/how-to-install-the-latest-versions-of-nodejs-and-npm/971612#971612
Build and install the interpreter in Buildroot with:
./build-buildroot --config 'BR2_PACKAGE_NODEJS=y'
Everything is then the same as the Python interpreter setup, except that the executable name is now node
!
TODO: build broken as of LKMC 3c3deb14dc8d6511680595dc42cb627d5781746d + 1:
ERROR: package host-nodejs installs executables without proper RPATH
Examples:
-
rootfs_overlay/lkmc/nodejs/hello.js: hello world
-
String
-
process
-
fs
-
class
-
rootfs_overlay/lkmc/nodejs/object_to_string.js:
util.inspect.custom
andtoString
override experiment: https://stackoverflow.com/questions/24902061/is-there-an-repr-equivalent-for-javascript/26698403#26698403 -
rootfs_overlay/lkmc/nodejs/object_to_json.js:
toJSON
examples
-
-
rootfs_overlay/lkmc/nodejs/http.js:
http
module to create a simple HTTP server: https://nodejs.org/api/http.html -
rootfs_overlay/lkmc/nodejs/esm: https://stackoverflow.com/questions/58384179/syntaxerror-cannot-use-import-statement-outside-a-module