Skip to content

Improve error message for running build statically #5479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 2 tasks
phil294 opened this issue Mar 17, 2017 · 3 comments
Closed
1 of 2 tasks

Improve error message for running build statically #5479

phil294 opened this issue Mar 17, 2017 · 3 comments

Comments

@phil294
Copy link

phil294 commented Mar 17, 2017

Bug Report or Feature Request (mark with an x)

  • bug report -> please search issues before submitting
  • feature request

Versions. (latest, 4.0)

@angular/cli: 1.0.0-rc.2
node: 6.10.0
os: linux x64
@angular/animations: 4.0.0-rc.3
@angular/common: 4.0.0-rc.3
@angular/compiler: 4.0.0-rc.3
@angular/compiler-cli: 4.0.0-rc.3
@angular/core: 4.0.0-rc.3
@angular/flex-layout: 2.0.0-rc.1
@angular/forms: 4.0.0-rc.3
@angular/http: 4.0.0-rc.3
@angular/platform-browser: 4.0.0-rc.3
@angular/platform-browser-dynamic: 4.0.0-rc.3
@angular/platform-server: 4.0.0-rc.3
@angular/router: 4.0.0-rc.3
@angular/cli: 1.0.0-rc.2
@ngtools/webpack: 1.2.13

Repro steps.

A ng build generates a dist/index.html. Running this file in your browser (aka file:///home/.../index.html) might seem intuitive but will not work (reason: cannot issue XHR requests).
However, the error message is not helpful at all, saying nothing but

EXCEPTION: Uncaught (in promise): SecurityError: The operation is insecure.
BrowserPlatformLocation.prototype.replaceState@file:///home/phi/d/ls/repo/web/dist/vendor.bundle.js:22446:13

Desired functionality.

Any hint to solve this error would be helpful.
Note: For local testing, I then set up an apache server inside the dist directory: php -S localhost:9090 -t . -c "/etc/php/7.0/apache2/php.ini"'. Seemed quickest to me.

@markuseckstein
Copy link

Not a solution but a quicker workaround:

you can install the npm package http-server globally. Then you can spin up a simple http-server in any directory you like, no need for a full blown Apache:

npm i -g http-server

Then use

http-server -o -c-1

in any directory. The -o option opens a browser automatically and -c-1 disables http caching.

@filipesilva
Copy link
Contributor

Please open this issue on https://github.com/angular/angular instead. That error is in an angular lib (BrowserPlatformLocation).

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants