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)
Cegone
  • 489
  • 1
  • 9
  • 23

1 Answers1

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.

Sreekumar P
  • 5,900
  • 11
  • 57
  • 82