Angular 2 / angular-cli problem


#1

Hi everyone,

I’m trying to develop an Angular2 project.
The deployment it works well, but when I run ng serve command the process remain idle.

Here below my shell after running the command:

~/workspace/MyApp (master) $ ng serve
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
** NG Live Development Server is running on http://localhost:8080. **
7608ms building modules
54ms sealing
0ms optimizing
0ms basic module optimization
125ms module optimization
0ms advanced module optimization
15ms basic chunk optimization
1ms chunk optimization
5ms advanced chunk optimization
0ms module and chunk tree optimization
192ms module reviving
9ms module order optimization
7ms module id optimization
5ms chunk reviving
0ms chunk order optimization
18ms chunk id optimization
93ms hashing
1ms module assets processing
244ms chunk assets processing
4ms additional chunk assets processing
0ms recording
1ms additional asset processing
2707ms chunk asset optimization
1960ms asset optimization
38ms emitting
Hash: aed8a509121577dff279
Version: webpack 2.1.0-beta.22
Time: 13121ms
Asset Size Chunks Chunk Names
main.bundle.js 2.83 MB 0, 2 [emitted] main
styles.bundle.js 10.2 kB 1, 2 [emitted] styles
inline.js 5.53 kB 2 [emitted] inline
main.map 2.88 MB 0, 2 [emitted] main
styles.map 14 kB 1, 2 [emitted] styles
inline.map 5.59 kB 2 [emitted] inline
index.html 475 bytes [emitted]
assets/.npmignore 0 bytes [emitted]
Child html-webpack-plugin for “index.html”:
Asset Size Chunks Chunk Names
index.html 2.81 kB 0
webpack: bundle is now VALID. (After this point the process remain idle)

Any tips will be appreciated.

L


#2

I also have a problem installing the angular-cli on a new projcet


#3

Got the same problem here.


#4

Run ng serve --host 0.0.0.0 --port 8080 solved it for me


#5

This maybe.


#6

Thank you very much to everybody.
The solution from merovinh it works.
Here below my steps in order to start an Angular2 app:

  1. I’ve reinstalled the versions of node.js and npm in according with angular’s website:
    https://angular.io/docs/ts/latest/quickstart.html#!#install-packages

  2. I’ve reinstalled the angular-cli:
    a) npm uninstall -g angular-cli
    b) npm cache clean
    c) npm install -g angular-cli@latest

  3. I’ve created a new app by the command: ng new myAngular2App

  4. ng serve --host 0.0.0.0 --port 8080

Thank you.

L


#7

Thank-you so much! Worked for me! :slight_smile:


#8

I had this issue myself, but I knew that Cloud9 needed to use 0.0.0.0 rather than localhost. You can make it so that you don’t have to type:
ng serve --host 0.0.0.0 --port 8080

You go to the root folder of the project you just created (where the package.json file is) and create a new file called .ember-cli
In that file you just put in the following:

{
    "host": "0.0.0.0",
    "port": 8080
}

Now, every time you run the ng serve command, it will run it as if you provided those extra parameters.


#9

It’s also possible to generate the app under the root of the workspace (if that’s the only app you’re working on in that workspace):

# in a clean workspace
nvm install stable
nvm alias default stable
npm install -g @angular/cli
cd && ng new workspace
cd workspace
ng serve -H 0.0.0.0

#10

hmmm, didn’t work here.


#11

My hack to encapsulate the host/port settings for ng serve was to create an alias, e.g.,

alias ng-serve=“ng serve --host 0.0.0.0 --port 8080”

Couldn’t get any of the suggested configuration file suggestions work at all.