【发布时间】:2026-01-11 20:55:01
【问题描述】:
我按照 vfat.tools (https://github.com/vfat-tools/vfat-tools) 的 README 说明进行操作,即运行 npm install,最后运行 npm run dev。我在控制台上看到以下内容:
[Browsersync] 访问 URL:
Local: http://localhost:3000
External: http://192.168.0.197:3000
UI: http://localhost:3001
UI 外部:http://localhost:3001
[Browsersync] 提供来自:dist 的文件 [Browsersync] 正在观看文件...
但是,当我打开 localhost:3000 访问 UI 时,我在 Chrome 的控制台上看到以下错误:
Refused to execute inline script because it violates the following Content Security Policy
directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-
ACotEtBlkqjCUAsddlA/3p2h7Q0iHuDXxk577uNsXwA='), or a nonce ('nonce-...') is required to enable
inline execution. Note also that 'script-src' was not explicitly set, so 'default-src'
is used as a fallback.
解决此问题的选项包括在代码中的某处添加unsafe-inline(例如 -> Script causes “Refused to execute inline script: Either the 'unsafe-inline' keyword, a hash… or a nonce is required to enable inline execution”),但我也觉得这不是一个好习惯。
如何让网页正常加载?
【问题讨论】:
标签: ethereum content-security-policy cryptocurrency