Getting started with a pxt extension for micro:bit

I’ve read through a lot of documentation regarding creating PXT extensions. I need to put one together for a third party micro:bit accessory I bought for my kids.

I was following along trying to get PXT to let me pick a target, but it fails to install pxt-microbit. I get a JSON parsing error:

Unexpected end of JSON input while parsing near '...6.4.12","dependencies'

In the error log, there are more details:

18 silly fetchPackageMetaData error for pxt-common-packages@8.3.1 Unexpected end of JSON input while parsing near ‘…6.4.12","dependencies’

Has anyone been able to get the PXT CLI to work lately?


oh interesting. What command did you run when you got your error?

I’ve moved on to doing everything semi-manually just to get through it. I believe the command was:

pxt target microbit

I also tried, npm install pxt-common-packages and got the same error. I think I tried something like npm install pxt-microbit and got a different JSON parsing error. I got these packages out of the error logs so I can’t recall exactly.

So far, doing it manually is not so bad. It would be nice if I could at least get some typedefs from pxt-microbit and pxt-neopixel though.