当我执行 ionic serve 时,它显示以下错误:
Refused to load the image 'http://localhost:8100/favicon.ico' because it violates the following Content Security Policy directive: "default-src 'none'". Note that 'img-src' was not explicitly set, so 'default-src' is used as a fallback.
Failed to load resource: the server responded with a status of 404 (Not Found)
我该如何解决这个问题?
最佳答案
我有同样的错误信息。
查看执行时打印的日志
ionic serve
向我展示了一堆错误,都与此类似
[ng] ERROR in ./src/global.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/global.scss)
[ng] Module build failed (from ./node_modules/sass-loader/lib/loader.js):
[ng] Error: Cannot find module 'node-sass'
[ng] Require stack:
这使我重新启动并运行应用程序
npm install node-sass --save
编译过程有时会不时地吐出相当困惑的错误消息,但稍微挖掘一下就可以开始猜测从哪里开始戳
关于ionic-framework - 执行 ionic serve 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56248740/