Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
8 views
in Technique[技术] by (71.8m points)

I have an error when executing ionic serve

When I execute ionic serve, it shows the following errors:

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)

How can I solve this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I had the same error message.

Looking through the logs printed when doing

ionic serve

showed me a bunch of errors, all similar to this


[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:

This lead me to get the application up and running again by

npm install node-sass --save

The compilation process is sometimes spitting out rather confusing error messages from time to time, but with a little digging one can start guessing where to start poking


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...