# Error trying to run local pxt server

**URL:** https://forum.makecode.com/t/error-trying-to-run-local-pxt-server/20638
**Category:** PXT
**Created:** [June 16, 2023, 4:19pm UTC](https://forum.makecode.com/t/error-trying-to-run-local-pxt-server/20638 "2023-06-16T16:19:17Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![saskia](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@saskia](https://forum.makecode.com/u/saskia)
#### Post date: [June 16, 2023, 4:19pm UTC](https://forum.makecode.com/t/error-trying-to-run-local-pxt-server/20638/1 "2023-06-16T16:19:18Z")

</div>

Hey, I am trying to run a local version of makecode as described in the tutorial ([https://github.com/microsoft/pxt-maker](https://github.com/microsoft/pxt-maker)).

I cloned the three mentioned gits, ran npm and build as in the tutorial and finished the setup. Since I did not make any changes and just wanted to try to run makecode locally I skipped the parts ‘Refresh dal.d.ts files’ and ‘CODAL changes’ and directly did the step Running by executing _pxt serve_

But uppon trying the command pxt serve it always throws the error I attached in the error log. It seems as if it has mainly two problems: First of all it cannot resolve the expression 'game‘ in playable.ts and second of all it says that the property ‘percentChance’ does not exist on type ‘typeof Math’.

This finally leads to the error 'Build failed: target build failed: Compiler test failed

Error: Compiler test failed

at Object.userError …’

It opened a new tab in my explorer but it only showed the makecode logo and did not move on.

Afterwards I tried to fix the problem by following the step ‘Refresh dal.d.ts files’ oft he tutorial. This ended with: ‘error: sim/tsconfig.json expected compilerOptions.outFile:“../built/sim.js”, got “undefined”’ but besides that it seemed to work.

Then I again tried pxt serve and I got the same error, except that this time it seemed to start the local server since I could open a new project.

I am still a little bit worried about the last error that said that the Build failed. What does that error mean and is it critical for the following steps of adding a new custom board?

Thanks in advance

Saskia

**Errorlog:**

C:\Users\MyPath\makecode\pxt-maker\>pxt serve  
Using target maker with build engine codal  
target: v C:\Users\MyPath\makecode\pxt-maker  
pxt-core: v C:\Users\MyPath\makecode\pxt  
building C:\Users\MyPath\makecode\pxt-maker\node\_modules\pxt-common-packages\sim…  
[run] cd C:\Users\MyPath\makecode\pxt-maker\node\_modules\pxt-common-packages\sim; node ../node\_modules/typescript/bin/tsc  
log strings: 24 files; 0 strings → sim-strings.json  
copying common-sim…  
C:/Users/MyPath/makecode/pxt-maker/node\_modules/@types/node/index.d.ts(35,1): error TS1084: Invalid ‘reference’ directive syntax.  
C:/Users/MyPath/makecode/pxt-maker/node\_modules/@types/node/index.d.ts(43,30): error TS1005: ‘=’ expected.  
C:/Users/MyPath/makecode/pxt-maker/node\_modules/@types/node/index.d.ts(46,30): error TS1005: ‘=’ expected.  
C:/Users/MyPath/makecode/pxt-maker/sim/dalboard.ts(174,87): error TS1109: Expression expected.  
C:/Users/MyPath/makecode/pxt-maker/sim/dalboard.ts(174,93): error TS1109: Expression expected.  
C:/Users/MyPath/makecode/pxt-maker/sim/dalboard.ts(174,126): error TS1005: ‘:’ expected.  
building target.json in C:\Users\MyPath\makecode\pxt-maker…  
building C:\Users\MyPath\makecode\pxt-maker\libs\base  
building C:\Users\MyPath\makecode\pxt-maker\libs\base—light  
…  
building C:\Users\MyPath\makecode\pxt-maker\libs\game  
building C:\Users\MyPath\makecode\pxt-maker\libs\game—light  
building C:\Users\MyPath\makecode\pxt-maker\libs\mixer  
playable.ts(36,9): error TS2304: Cannot find name ‘game’.

playable.ts(40,9): error TS2304: Cannot find name ‘game’.

soundEffect.ts(310,22): error TS2339: Property ‘percentChance’ does not exist on type ‘typeof Math’.

soundEffect.ts(320,67): error TS2339: Property ‘percentChance’ does not exist on type ‘typeof Math’.

building C:\Users\MyPath\makecode\pxt-maker\libs\mixer—none  
playable.ts(36,9): error TS2304: Cannot find name ‘game’.

playable.ts(40,9): error TS2304: Cannot find name ‘game’.

soundEffect.ts(310,22): error TS2339: Property ‘percentChance’ does not exist on type ‘typeof Math’.

soundEffect.ts(320,67): error TS2339: Property ‘percentChance’ does not exist on type ‘typeof Math’.

… and many other similar errors  
…  
building C:\Users\MyPath\makecode\pxt-maker\libs\wifi—esp32  
building C:\Users\MyPath\makecode\pxt-maker\libs\mqtt  
building C:\Users\MyPath\makecode\pxt-maker\libs\azureiot  
azureiot.ts(38,35): error TS2304: Cannot find name ‘crypto’.  
building C:\Users\MyPath\makecode\pxt-maker\libs\settings  
building C:\Users\MyPath\makecode\pxt-maker\libs\settings—esp32

… again some building and similar errors as those before

pxt\_modules/mixer—samd/soundEffect.ts(320,67): error TS2339: Property ‘percentChance’ does not exist on type ‘typeof Math’.

* * *

\*\*\* Build failed: target build failed: Compiler test failed  
Error: Compiler test failed  
at Object.userError (C:\Users\MyPath\makecode\pxt\built\pxt.js:98791:25)  
at C:\Users\MyPath\makecode\pxt\built\pxt.js:164148:19  
at async C:\Users\MyPath\makecode\pxt\built\pxt.js:162696:19  
at async C:\Users\MyPath\makecode\pxt\built\pxt.js:99398:42  
at async Promise.all (index 0)  
at async promisePoolAsync (C:\Users\MyPath\makecode\pxt\built\pxt.js:99404:21)  
at async buildTargetCoreAsync (C:\Users\MyPath\makecode\pxt\built\pxt.js:162678:5)  
at async buildTarget (C:\Users\MyPath\makecode\pxt\built\pxt.js:162943:13)  
at async buildAndWatchTargetAsync (C:\Users\MyPath\makecode\pxt\built\pxt.js:162970:5)

* * *

## Starting server in C:\Users\MyPath\makecode\pxt-maker With pxt core at C:\Users\MyPath\makecode\pxt starting local ws server at 3233…

To launch the editor, open this URL:  
[http://localhost:3232/#local\_token=b76f132c-ad13-42b2-7388-1f607dec50b1&wsport=3233](http://localhost:3232/#local_token=b76f132c-ad13-42b2-7388-1f607dec50b1&wsport=3233)

* * *

opening [http://localhost:3232/#local\_token=b76f132c-ad13-42b2-7388-1f607dec50b1&wsport=3233](http://localhost:3232/#local_token=b76f132c-ad13-42b2-7388-1f607dec50b1&wsport=3233)

---

<div class="post-metadata">

### Author: ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)
#### Post date: [June 16, 2023, 4:29pm UTC](https://forum.makecode.com/t/error-trying-to-run-local-pxt-server/20638/2 "2023-06-16T16:29:02Z")

</div>

maker doesn’t currently work with the latest pxt-common-packages, you need version 10.1.1

```auto
cd pxt-common-packages
git checkout v10.1.1

```

---

<div class="post-metadata">

### Author: ![saskia](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@saskia](https://forum.makecode.com/u/saskia)
#### Post date: [June 30, 2023, 4:22pm UTC](https://forum.makecode.com/t/error-trying-to-run-local-pxt-server/20638/3 "2023-06-30T16:22:36Z")

</div>

Thanks for your advice, it solved most of the errors. The only error I have left is the one in the new Errorlog. Is this a critical error? It seems as if I can still start a local hosted session even though this error is thrown.

**Errorlog:**

C:\Users\MyPath\makecode\pxt-maker\>pxt serve  
Using target maker with build engine codal  
target: v0.15.66 C:\Users\MyPath\makecode\pxt-maker  
pxt-core: v9.1.1 C:\Users\MyPath\makecode\pxt  
building C:\Users\MyPath\makecode\pxt-maker\node\_modules\pxt-common-packages\sim…  
[run] cd C:\Users\MyPath\makecode\pxt-maker\node\_modules\pxt-common-packages\sim; node ../node\_modules/typescript/bin/tsc  
../libs/mixer/sim/music.ts:3:58 - error TS2345: Argument of type ‘RefBuffer’ is not assignable to parameter of type ‘Uint8Array’.  
Type ‘RefBuffer’ is missing the following properties from type ‘Uint8Array’: BYTES\_PER\_ELEMENT, buffer, byteLength, byteOffset, and 27 more.

3 return AudioContextManager.playInstructionsAsync(b)  
~  
Found 1 error in ../libs/mixer/sim/music.ts:3

* * *

\*\*\* Build failed: common sim build failed: Exit code: 2 from cd C:\Users\MyPath\makecode\pxt-maker\node\_modules\pxt-common-packages\sim; node ../node\_modules/typescript/bin/tsc  
Error: Exit code: 2 from cd C:\Users\MyPath\makecode\pxt-maker\node\_modules\pxt-common-packages\sim; node ../node\_modules/typescript/bin/tsc  
at ChildProcess. (C:\Users\MyPath\makecode\pxt\built\nodeutil.js:78:24)  
at ChildProcess.emit (node:events:513:28)  
at maybeClose (node:internal/child\_process:1091:16)  
at ChildProcess.\_handle.onexit (node:internal/child\_process:302:5)

* * *

## Starting server in C:\Users\MyPath\makecode\pxt-maker With pxt core at C:\Users\MyPath\makecode\pxt starting local ws server at 3233…

To launch the editor, open this URL:  
[http://localhost:3232/#local\_token=b76f132c-ad13-42b2-7388-1f607dec50b1&wsport=3233](http://localhost:3232/#local_token=b76f132c-ad13-42b2-7388-1f607dec50b1&wsport=3233)

* * *

opening [http://localhost:3232/#local\_token=b76f132c-ad13-42b2-7388-1f607dec50b1&wsport=3233](http://localhost:3232/#local_token=b76f132c-ad13-42b2-7388-1f607dec50b1&wsport=3233)  
offline HEX not found: C:\Users\MyPath\makecode\pxt-maker\built\hexcache\d01e6d77faa7450bdaa33e2c609e0fdedd76af3b34f5cefc09c387fd9c76add9.hex  
ws connection at /b76f132c-ad13-42b2-7388-1f607dec50b1/hid  
offline HEX not found: C:\Users\MyPath\makecode\pxt-maker\built\hexcache\1c9f7c3ccdda1c40617f9990d5dc907c922c0a4c639147d99f7c6a6df149eb95.hex

---

<div class="post-metadata">

### Author: ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)
#### Post date: [June 30, 2023, 4:28pm UTC](https://forum.makecode.com/t/error-trying-to-run-local-pxt-server/20638/4 "2023-06-30T16:28:57Z")

</div>

Hmmm… you might need to go back to an older version of pxt too. Looks like pxt-maker is currently on [8.1.1](https://github.com/microsoft/pxt-maker/blob/master/package.json#L47).

The local serve should work even with those errors, but if you make any changes to the sim then you might run into issues. Switching to the old pxt should fix them.

Out of curiosity, what are you trying to do with pxt-maker locally? If you’re just working on TypeScript projects and not blocks, you might have more luck using [the makecode cli](https://github.com/microsoft/pxt-mkc) instead.

---

<div class="post-metadata">

### Author: ![saskia](https://avatars.discourse-cdn.com/v4/letter/s/ecb155/32.png) [@saskia](https://forum.makecode.com/u/saskia)
#### Post date: [July 1, 2023, 11:41pm UTC](https://forum.makecode.com/t/error-trying-to-run-local-pxt-server/20638/5 "2023-07-01T23:41:43Z")

</div>

Thanks, I’ll see if it works.  
I am trying to add a robot I designed to makecode by adding it as a new board. Therefore I need to try a few things locally 🙂

---

<div class="post-metadata">

### Author: ![campey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/campey/32/16370_2.png) [@campey](https://forum.makecode.com/u/campey)
#### Post date: [September 25, 2024, 4:43pm UTC](https://forum.makecode.com/t/error-trying-to-run-local-pxt-server/20638/6 "2024-09-25T16:43:21Z")

</div>

Thanks @richard for those pointers, I’d been bashing my head against trying to get pxt-maker running to try to get some traction on it,  
what worked for me was:

```auto
pxt-common-packages @ v10.1.1
pxt @ v8.1.1
node @ v16.20.2

```

and now it is serving in the best way yet (icons working, sim working, still with a number of errors in the console)

a win for code archaeology!

---

<div class="post-metadata">

### Author: ![GabrielT](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@GabrielT](https://forum.makecode.com/u/GabrielT)
#### Post date: [April 7, 2025, 5:00pm UTC](https://forum.makecode.com/t/error-trying-to-run-local-pxt-server/20638/7 "2025-04-07T17:00:33Z")

</div>

@richard Would it be possible for you to provide a list of what would needs to be updated to make `pxt-maker` compatible with the latest versions of `pxt` and `pxt-common-packages`? I’d like to work on updating the repo but not sure where to start.

---

<div class="post-metadata">

### Author: ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)
#### Post date: [April 7, 2025, 9:44pm UTC](https://forum.makecode.com/t/error-trying-to-run-local-pxt-server/20638/8 "2025-04-07T21:44:01Z")

</div>

@GabrielT oh boy, maker is very old at this point so i’m not even sure where i’d start… i will try and take a look at it later this week when i have a little less on my plate

---

<div class="post-metadata">

### Author: ![GabrielT](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@GabrielT](https://forum.makecode.com/u/GabrielT)
#### Post date: [April 22, 2025, 11:50am UTC](https://forum.makecode.com/t/error-trying-to-run-local-pxt-server/20638/9 "2025-04-22T11:50:26Z")

</div>

Hey @richard, I’m just checking in. Did you get a chance to take a look at Maker? There’s no rush; I just wanted to see where things stand.

---

<div class="post-metadata">

### Author: ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)
#### Post date: [April 23, 2025, 6:50pm UTC](https://forum.makecode.com/t/error-trying-to-run-local-pxt-server/20638/10 "2025-04-23T18:50:33Z")

</div>

@GabrielT sorry about that! i totally forgot!

i’ve opened a PR to get pxt-maker building with latest pxt and pxt-common-packages:

> <https://github.com/microsoft/pxt-maker/pull/381>
>
> requires https://github.com/microsoft/pxt-common-packages/pull/1519
> 
> gets make…r building with the latest pxt/pxt-common-packages
> 
> i still need to regenerate dal.d.ts but i'm not set up for that on my dev environment right now!

granted i only did some cursory testing and didn’t try any hardware, but it looks like it’s working. once this is merged i’ll bump it to beta so that you can test it out

---

<div class="post-metadata">

### Author: ![MeatballDev](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/meatballdev/32/28502_2.png) [@MeatballDev](https://forum.makecode.com/u/MeatballDev)
#### Post date: [April 23, 2025, 6:53pm UTC](https://forum.makecode.com/t/error-trying-to-run-local-pxt-server/20638/11 "2025-04-23T18:53:24Z")

</div>

this case took 2 years to solve, but you know what they say  
better late than never
