Hello Console
How to set up the basic development environment and run your first program
Install the CLI
xs-dev
can be installed globally using the NodeJS package manager of your choice.
Setup system tooling
As specified in the setup documentation, the Moddable SDK and associated tooling is installed using the following command:
This will determine the correct tooling to install based on your operating system.
Windows support is currently in beta
Once this process is done, you should see a success message:
or on Windows, you should see the following:
Run the Hello World example
To start a new terminal session, you can either execute your shell of choice (bash
/zsh
/fish
), create a new terminal window / tab, or start the Moddable Command Prompt on Windows. This will ensure the expected tooling is available in your session PATH.
You can run any Moddable example included in the SDK. The “Hello World” example provides the simplest program to get started and can be run in the simulator:
This will start up the debugger and simulator:
This will keep running until interrupted using the Ctrl+C
keys in the terminal session or both apps are quit.
Keep exploring!
Use the --list-examples
flag with the run
command to search the extensive list of available examples to run in the simulator: xs-dev run --list-examples
When you’re ready to move on, it’s time to create your first project and control some hardware.
Troubleshooting
When attempting to run the Hello World example, if you continually see the following error (even after starting a new terminal session):
There may be an issue with the terminal shell or command prompt using the correct environment configuration for xs-dev.
- Learn about Terminal profiles on MacOS
- Learn about shell initialization files and user profiles on Linux
- Learn about Windows Terminal startup settings
On “Unix-like” environments (MacOS, Linux), the env
command should contain a reference to the MODDABLE
environment variable:
The above command should return something like MODDABLE=/Users/<username>/.local/share/moddable
to indicate where the Moddable SDK has been installed in the filesystem.
Running xs-dev doctor
command will display relevant info about the development environment, which can be helpful for debugging and sharing in support issues: