If you're using a recent stable Debian or Ubuntu release, you can install and run a development version of of MakeCode directly on your system. (For a more contained solution that should work on Windows or MacOS, skip ahead to the next section of this guide.)
First, open a terminal and create a new directory to contain the PXT code repositories by typing the following commands:
mkdir makecode-adafruit
cd makecode-adafruit
Next, create a file called install-makecode.sh
with nano
, or the text editor of your choice:
nano install-makecode.sh
And paste the following script into the file:
#!/bin/sh # Install Node.js: curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs # Install some dependencies: sudo apt-get install git libsecret-1-dev sudo npm install -g jake sudo npm install -g typings sudo npm install -g pxt # Clone repos from GitHub: git clone https://github.com/Microsoft/pxt git clone https://github.com/Microsoft/pxt-common-packages git clone https://github.com/Microsoft/pxt-adafruit cd pxt npm install typings install jake cd .. cd pxt-common-packages npm install sudo npm link ../pxt cd .. cd pxt-adafruit npm install sudo npm link ../pxt sudo npm link ../pxt-common-packages
Save the file and exit (in nano
, press Ctrl-X, followed by y and Enter to write the file).
The script installs Node.js, the Git version control system, and several other dependencies. It then checks out the latest development versions of the PXT code and installs it.
Run it with:
sh install-makecode.sh
This should take quite a while to finish.
Now you can run the following at the command prompt:
cd pxt-adafruit
pxt serve --cloud
This step will also take quite a while the first time you run it, since it needs to build various resources.
Eventually, MakeCode should print something like the following...
starting local ws server at 3233...
---------------------------------------------
To launch the editor, open this URL:
http://localhost:3232/#local_token=0918998d-feec-4217-3c97-41d14634b51f&wsport=3233
---------------------------------------------
opening http://localhost:3232/#local_token=0918998d-feec-4217-3c97-41d14634b51f&wsport=3233
...and then open in your web browser:
You can press Ctrl-C in the terminal to stop the MakeCode process. To start it again, just remember to cd
to the project directory and run pxt serve --cloud
again:
cd ~/makecode-adafruit/pxt-adafruit
pxt serve --cloud
Text editor powered by tinymce.