0

当我在我的 ember-cli 项目中上传液体火时,我得到一个白屏,这是我得到的错误,我正在运行 ember 版本 1.13.1,node.12.2,npm 2.12.1,liquid-fire 0.20.4,第二次我卸载了liquid-fire,它开始工作得很好,有什么想法吗?

about:1 [Report Only] Refused to load the script'http://maps.googleapis.com/maps/api/js?v=3' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' https://*.googleapis.com https://*.gstatic.com  data: localhost:35729 0.0.0.0:35729".

about:13 POST http://0.0.0.0:4200/csp-report net::ERR_ADDRESS_INVALID
js?v=3:8 [Report Only] Refused to load the script 'http://maps.gstatic.com/maps-api-v3/api/js/20/13/main.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' https://*.googleapis.com https://*.gstatic.com  data: localhost:35729 0.0.0.0:35729".

js?v=3:8 POST http://0.0.0.0:4200/csp-report net::ERR_ADDRESS_INVALID
about:16 [Report Only] Refused to load the stylesheet 'http://fonts.googleapis.com/css?family=EB+Garamond' because it violates the following Content Security Policy directive: "style-src 'self' 'unsafe-inline' https://*.googleapis.com  data:".

about:16 [Report Only] Refused to load the stylesheet 'http://fonts.googleapis.com/css?family=Lily+Script+One' because it violates the following Content Security Policy directive: "style-src 'self' 'unsafe-inline' https://*.googleapis.com  data:".

about:16 POST http://0.0.0.0:4200/csp-report net::ERR_ADDRESS_INVALID
about:23 GET http://localhost:4200/assets/bootstrap.css.map 404 (Not Found)
velocity.js:660 [Report Only] Refused to load the font 'http://fonts.gstatic.com/s/ebgaramond/v7/kYZt1bJ8UsGAPRGnkXPeFY4P5ICox8Kq3LLUNMylGO4.woff2' because it violates the following Content Security Policy directive: "font-src 'self' https://*.gstatic.com  data:".

velocity.js:660 [Report Only] Refused to load the font 'http://fonts.gstatic.com/s/lilyscriptone/v4/uPWsLVW8uiXqIBnE8ZwGPCJccsb45t3MJKcv5BJtrIs.woff2' because it violates the following Content Security Policy directive: "font-src 'self' https://*.gstatic.com  data:".

ember.debug.js:48 Uncaught Error: Could not find module htmlbars-runtime
velocity.js:660 POST http://0.0.0.0:4200/csp-report net::ERR_ADDRESS_INVALID
about:1 [Report Only] Refused to load the font 'http://fonts.gstatic.com/s/ebgaramond/v7/kYZt1bJ8UsGAPRGnkXPeFY4P5ICox8Kq3LLUNMylGO4.woff2' because it violates the following Content Security Policy directive: "font-src 'self' https://*.gstatic.com  data:".

about:1 POST http://0.0.0.0:4200/csp-report net::ERR_ADDRESS_INVALID
bundle.js:1 init on: localhost
main.js:27 [Report Only] Refused to load the script 'http://maps.gstatic.com/maps-api-v3/api/js/20/13/common.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' https://*.googleapis.com https://*.gstatic.com  data: localhost:35729 0.0.0.0:35729".

main.js:27 [Report Only] Refused to load the script 'http://maps.gstatic.com/maps-api-v3/api/js/20/13/util.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' https://*.googleapis.com https://*.gstatic.com  data: localhost:35729 0.0.0.0:35729".

main.js:27 [Report Only] Refused to load the script 'http://maps.gstatic.com/maps-api-v3/api/js/20/13/stats.js' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' https://*.googleapis.com https://*.gstatic.com  data: localhost:35729 0.0.0.0:35729".

main.js:27 POST http://0.0.0.0:4200/csp-report net::ERR_ADDRESS_INVALID
main.js:27 [Report Only] Refused to load the script 'http://maps.googleapis.com/maps/api/js/AuthenticationService.Authenticate?1…p%3A%2F%2Flocalhost%3A4200%2Fabout&5e1&callback=_xdc_._nayihi&token=102154' because it violates the following Content Security Policy directive: "script-src 'self' 'unsafe-eval' https://*.googleapis.com https://*.gstatic.com  data: localhost:35729 0.0.0.0:35729".

main.js:27 POST http://0.0.0.0:4200/csp-report net::ERR_ADDRESS_INVALID
4

1 回答 1

0

您的问题可能与内容安全策略有关。您需要在 config/environment.js 中为 script-src 和 font-src 配置 environment.js。

module.exports = function(environment) {
  var ENV = {
    contentSecurityPolicy: {
      'default-src': "'none'",
      'script-src': "'self' 'unsafe-inline' 'unsafe-eval'   maps.googleapis.com maps.gstatic.com",
      'font-src': "'self' data: fonts.gstatic.com",
      ....
    },

};
于 2015-07-19T23:31:15.430 回答