0

I've tried to deploy the angular application in my local, I've done the npm-build and got dist, then i tried to execute the http-server command i receive the below error.

changed the port number, cleared the cache, closed and opened the cmd, restarted the machine.

What i need change.

I've tried with new simple project and downloaded one boilerplate from github and my existing project, for all the three projects i received the below error.

Starting up http-server, serving ./
Available on:
  http://--.--.---.--:8080
  http://127.0.0.1:8080
Hit CTRL-C to stop the server
events.js:174
      throw er; // Unhandled 'error' event     ^

Error: read EINVAL
    at TTY.onStreamRead (internal/stream_base_commons.js:111:27)
Emitted 'error' event at:
    at emitErrorNT (internal/streams/destroy.js:82:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:50:3)
    at process._tickCallback (internal/process/next_tick.js:63:19)
2
  • 1
    ng serve isn't enough ? just curious that why using http-server Commented Apr 16, 2019 at 6:44
  • Thank you.. ng serve is working fine, but any guesses for that issue. Commented Apr 16, 2019 at 7:09

1 Answer 1

1

Its always better to use angular cli command ng serve for building/running angular apps.

However if you want to use http-server, you need to run the command for the output folder path of project. My default it will be dist.

Run below 2 commands:

ng build
http-server ./dist

ng build required to build all your source code and then populate dist folder. Then you can run http-server for running it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.