Skip to content

Prerequisites

Prepare for embedded JS development

Getting started on the journey to developing embedded hardware projects with JavaScript assumes some knowledge of various technologies like the command line, text editors, package managers, and the JavaScript programming language.

Command Line

Tutorial content will reference command line utilities and jargon as part of the workflow for developing embedded JS projects. Select your operating system to learn more about this subject:

Inline terminal commands will usually be formatting like the following: echo "hello world"

Code examples will look like the following:

trace('hello world')

Text Editors

A local plain text editor is generally required for creating and editing your JavaScript projects. You can download one of the following free applications with either built-in or third-party support for JavaScript:

These are not the only available editors, so feel free to do your own research and pick what feels right to you!

NodeJS & Package Manager (optional)

While NodeJS is not required for Moddable XS projects, it is a dependency for installing and using the xs-dev CLI.

Node can be downloaded directly from the website, however using one of the following version managers can help with quickly switching to recommended versions of the tooling in the future:

Node comes with npm as the included package manager, but there are other options available if needed:

Troubleshooting

If you encounter an EACCES error after setting up NodeJS and attempt to install a package, like the following:

Error: EACCES: permission denied, mkdir

Check out the npm docs to learn about to resolve it: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally

Linux Permissions

Setup commands rely on ssh-askpass to prompt for permission when installing other tools and dependencies.

Choose your hardware adventure

Hardware is not required to get started with xs-dev, or even to run some code, since there are simulated devices available with the Moddable SDK.

Simulators are fun and everything, but controlling hardware with JavaScript is even better! xs-dev supports a few popular hardware platforms through Moddable:

Each platform has a variety of features and form factors to support whatever you might dream up. This guide will do its best to provide code and diagrams that match the expectations of your chosen device(s) but cannot promise comprehensive coverage of every piece of hardware in existence.

If you run into issues or have a question, please start a discussion in the GitHub repo.

Once you feel ready, move on the first step of installing the CLI and the Moddable SDK.