angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.76k stars 11.98k forks source link

ng server --open just showing default index.html page #6565

Closed shantigithub closed 7 years ago

shantigithub commented 7 years ago

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

ISSUE: $ng serve --open is not compiling .ts files and not updating index.html page either. Just shows 'loading...' in index.html. I couldn't find any .js files (result of build). However, If i update index.html page, then page reloading with updates. So i think no issue with serve demon but not compiling any ts files. I see no errors at command prompt. if I use ng build then I see all build output in dist directory.

Versions.

SYSTEM : MAC : OS X 10.10.5 Yosomite.

ng --version

@angular/cli: 1.0.6 node: 6.10.3 os: darwin x64 @angular/common: 4.1.3 @angular/compiler: 4.1.3 @angular/core: 4.1.3 @angular/forms: 4.1.3 @angular/http: 4.1.3 @angular/platform-browser: 4.1.3 @angular/platform-browser-dynamic: 4.1.3 @angular/router: 4.1.3 @angular/cli: 1.0.6 @angular/compiler-cli: 4.1.3

Repro steps.

I reproduced issue by creating retro-app. $ ng new retro-app

installing ng create .editorconfig create README.md create src/app/app.component.css create src/app/app.component.html create src/app/app.component.spec.ts create src/app/app.component.ts create src/app/app.module.ts create src/assets/.gitkeep create src/environments/environment.prod.ts create src/environments/environment.ts create src/favicon.ico create src/index.html create src/main.ts create src/polyfills.ts create src/styles.css create src/test.ts create src/tsconfig.app.json create src/tsconfig.spec.json create src/typings.d.ts create .angular-cli.json create e2e/app.e2e-spec.ts create e2e/app.po.ts create e2e/tsconfig.e2e.json create .gitignore create karma.conf.js create package.json create protractor.conf.js create tsconfig.json create tslint.json Installing packages for tooling via npm. Installed packages for tooling via npm. Project 'repro-app' successfully created.

$ng serve --open

NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200 10% building modules 6/9 modules 3 active ...ode_modules/style-loader/addStyles.jswebpack: wait until bundle finished: / Hash: 407bcd15a9dbfc71fa02
Time: 8701ms chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 158 kB {4} [initial] [rendered] chunk {1} main.bundle.js, main.bundle.js.map (main) 3.63 kB {3} [initial] [rendered] chunk {2} styles.bundle.js, styles.bundle.js.map (styles) 10.5 kB {4} [initial] [rendered] chunk {3} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.4 MB [initial] [rendered] chunk {4} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered] webpack: Compiled successfully.

Note: Browser is getting opened showing default index.html . I see no generated .js files. However if i manually update index.html then page is getting reloaded.

The log given by the failure.

I see no log or errors other than pasted output above. please let me know where can i find detailed log or change log level.

Desired functionality.

Mention any other details that might be useful.

Please note that quickstart app using local development (using npm ) is working fine. I am just trying to make it work using CLI. I have tried my best to search through open and closed issues. Couldn't find related issue.

shantigithub commented 7 years ago

I did $npm ls It seems some items missing. Could this be the reason why .ts files not getting compiled? However when i use $ng build then i see that all build output getting created in dist folder.

npm ls /Users/shantiputta/Angular_WS ├── UNMET PEER DEPENDENCY @angular/compiler@^2.3.1 ├── UNMET PEER DEPENDENCY @angular/compiler-cli@^2.3.1 ├── UNMET PEER DEPENDENCY @angular/core@^2.3.1 ├── UNMET PEER DEPENDENCY @angular/tsc-wrapped@^0.5.0 ├─┬ @ngtools/webpack@1.2.8 │ ├─┬ enhanced-resolve@2.3.0 │ │ ├── graceful-fs@4.1.11 │ │ ├─┬ memory-fs@0.3.0 │ │ │ ├─┬ errno@0.1.4 │ │ │ │ └── prr@0.0.0 │ │ │ └─┬ readable-stream@2.2.10 │ │ │ ├── core-util-is@1.0.2 │ │ │ ├── inherits@2.0.3 │ │ │ ├── isarray@1.0.0 │ │ │ ├── process-nextick-args@1.0.7 │ │ │ ├── safe-buffer@5.1.0 │ │ │ ├─┬ string_decoder@1.0.1 │ │ │ │ └── safe-buffer@5.1.0 deduped │ │ │ └── util-deprecate@1.0.2 │ │ ├── object-assign@4.1.1 │ │ └── tapable@0.2.6 │ ├─┬ loader-utils@0.2.17 │ │ ├── big.js@3.1.3 │ │ ├── emojis-list@2.1.0 │ │ ├── json5@0.5.1 │ │ └── object-assign@4.1.1 deduped │ ├─┬ magic-string@0.16.0 │ │ └── vlq@0.2.2 │ └── source-map@0.5.6 ├── UNMET PEER DEPENDENCY reflect-metadata@^0.1.8 ├── UNMET PEER DEPENDENCY typescript@^2.0.2 └── UNMET PEER DEPENDENCY webpack@2.2.0

npm ERR! peer dep missing: @angular/compiler@^2.3.1, required by @ngtools/webpack@1.2.8 npm ERR! peer dep missing: @angular/compiler-cli@^2.3.1, required by @ngtools/webpack@1.2.8 npm ERR! peer dep missing: @angular/core@^2.3.1, required by @ngtools/webpack@1.2.8 npm ERR! peer dep missing: @angular/tsc-wrapped@^0.5.0, required by @ngtools/webpack@1.2.8 npm ERR! peer dep missing: typescript@^2.0.2, required by @ngtools/webpack@1.2.8 npm ERR! peer dep missing: reflect-metadata@^0.1.8, required by @ngtools/webpack@1.2.8 npm ERR! peer dep missing: webpack@2.2.0, required by @ngtools/webpack@1.2.8

filipesilva commented 7 years ago

@shantigithub ng serve compiles and serves the application files from memory, so there is no build artifacts on disk.

When you do ng build you get a dist/ folder containing the compiled files, for when you deploy your app to a production server.

shantigithub commented 7 years ago

Thanks filipsiva. I hope i am not wasting your valuable time. But clearly some issue is there or I am missing something. Today I tested with clean install of npm and angular CLI. Issue is that when i run ng serve --open , it is still showing only default index.html page in Safari but when i access URL localhost:4200 using Firefox Brower it is perfectly working.

figuerres commented 7 years ago

What happens if you just run ng serve and then use a browser ? Does that act normally ? Also if you use chrome look at the developer tools network log, is it requesting the js files ? that will give a better idea of what is wrong.

shantigithub commented 7 years ago

it is same behaviour in Safari even if i manually open the page localhost:4200 . Just shows default index.html page. If I touch a .ts file, I see activity at command prompt that this are being compiled but nothing changes in Safari browser. However when I open the URL in firefox, it is working fine including reflecting the updates. It seems issue is specific to Safari. I will check using Chrome. Where can i check detailed logs of ng serve ?

figuerres commented 7 years ago

So I wonder if something is up with safari on your mac? Like JavaScript disabled or not trusting localhost on port 4200 or some other web proxy on your mac. The index page should be calling for script that should make it work. It sounds like no script is loaded or script execution is blocked. I am not familiar with safari tools so I am not sure where to look next. The ng serve may not have logs , but the reload on change I think is done with a browser plug in, a normal web server and browser setup does not do that re load, it's just to help developers.

shantigithub commented 7 years ago

It is working in Safari browser as expected after I upgraded to Mac Sierra (10.12.5) that updated Safari to 10.1.1 . I looked error console from Develop in Safari and noted lots of Java Script error loading issues (Java Script is enabled in browser) so i chose to upgrade and it worked. Thanks for help.

filipesilva commented 7 years ago

Ah that makes sense... that must have been a javascript error that prevented anything else from running. Glad you got it sorted!

angular-automatic-lock-bot[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.