Error test project using html5


Hi, i just start using openFL. I try this example
When i test the project for html5, it give this error.
Error: EINVAL, invalid argument
at new Socket (net.js:156:18)
at process.stdin (node.js:664:19)
at Object. (C:\HaxeToolkit\haxe\lib\lime\7,2,1\templates\bin\node\http-server\bin\http-server:161:19)
at Module._compile (module.js:456:26)
at Object.Module._extensions…js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3

Testing the project in flash and neko work fine.
Please help me.


When you test an HTML5 project, it first starts an HTTP server so you can run your app locally.
By default, it will listen on the port TCP 2000, but maybe this port is already in use by your system ?


Previously i try the Displaying a Bitmap example.
Testing that example as html5 it run just fine on port 3000.
Now, when i run it again, it give the same error as the Adding Animation example.
If i run the project Adding Animation from haxedevelop, it does work fine. It show port 2000 in the url. I dont think there is any conflict between running from haxe develop and cli because previously i can run them both for Displaying a Bitmap example project.

I use command netstat -ano | find “3000” in command prompt, nothing show up.
I look in xampp netstat also doesnt see anything run on port 3000 or 2000.


So everything runs fine if you use the Haxelib version, but not the NPM version, right ?
Maybe the server detected that port 3000 was used and switched to 3001… did you try http://localhost:3001 ?


You might have to Ctrl + C or Ctrl + D on the command prompt you used to kill the previous process, so the port is available again.

You can also use --port=3001 or any other port number you want. Another approach is to use a command such as:

openfl test html5 --port=4000 -nolaunch

The above will not open the browser, so you can cancel it and run it again, then reload the browser, instead of getting a new tab. One more approach might be to open one window:

openfl build html5

Then in a second:

openfl run html5 --port=3002

The second process (running the web-server) can continue to run, while the first (which did the build) can be re-run at will. There’s also a beta “watch” feature that you could try with this two-process approach as well:

openfl build html5 -watch

-watch doesn’t work currently with test html5 because of port conflicts, but it should work with build html5. The idea is it will run the build command every time a source file is edited and saved.


I tried openfl test html5 --port=3001 it give same error.
I tried openfl test html5 --port=4000 -nolaunch
it respond with
Starting local web server: http://localhost:4000

Then it give error like before
Error: EINVAL, invalid argument
at new Socket (net.js:156:18)
at process.stdin (node.js:664:19)
at Object. (C:\HaxeToolkit\haxe\lib\lime\7,2,1\templates\bin\node\http-server\bin\http-server:161:19)
at Module._compile (module.js:456:26)
at Object.Module._extensions…js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3

Porbably the problem is not port?


I resintall haxe to start over. Then
haxelib install openfl
Error: Invalid string length
I cannot install openfl now?

I double click on haxe. exe then open cli again, i use git bash.
haxelib install openfl complete but next step
haxelib run openfl setup
Error: Invalid string length
Error: Library lime is not installed
why? last thursday i install openfl without install lime and work just fine. I install lime after that when i want to test android build.

so i do
haxelib install lime
Error: Invalid string length

Is there something wrong with my haxe installation? previously install on C drive, now change to D drive also same.


Today i run
haxelib run openfl setup
and it work.
Open Fl installed. I didnt change anything, but it suddenly work. Really weird.
But still openfl test html5 give same error.


Does it work if you use the Windows Command-Prompt?


My last reply saying can install openfl again is for my home pc.
My office pc still give Error: Invalid string length
Using windows command prompt also wont work.
So the scenario is first time installation, work on both my office pc and home pc.
And openfl test htm5 also work previously. If i am not mistaken, after i run openfl test neko, then openfl test html5 give the einval error, happen on both pc.
So after try different port fail, i uninstall haxe. After reinstall haxe, installing openlf give invalid string lenthg error, happen on both pc.


Did you check that you have administration rights when installing haXe/lime/OpenFL ?


Can you try an OpenFL sample?

openfl create DisplayingABitmap
cd DisplayingABitmap
openfl test html5


I am using windows 7. I alredy run those program as administrator. So i think i do has permission. Also i can install other library like haxelib install react, no problem at all.

I did use the samples, give same error.


When you reinstalled haXe, you had administrator rights too, right ?
If that’s the case, please try to run this command :
haxelib setup
It should display the current location of the repository path.
So you may want to adjust it, then try :

haxelib remove lime 
haxelib remove openfl
haxelib install lime 
haxelib install openfl


Alredy done that, got same error. And i think if the problem is administrators right, other library should fail to install too. But i can install react and others. 2 library that i know fail to install on my office pc right now is lime and openfl.
I did try install on my friend’s pc which using windows 10, and it fail as well.
I also try install on ubuntu that i run using virtual box and it work fine.
My home pc with windows 7 somehow can install openfl again, i dont know why. But my office pc still cannot install.
Regarding the einval error when do openfl test html5. I try lime it self without openfl, i create lime sample. So then lime test html5 also give same error. Which make me believe the openfl error is actually lime error.


Alredy solve the reinstallion issue. It seem my office intertnet is the reason for the invalid string length error. Using alternative internet line, i can install openfl again.
But the EINVAL, invalid argument error still appear when i do openfl test html5.