我在nodejs上有一个聚合物应用程序。我可以从vscode启动,但是当我在浏览器中访问该站点时,它给了我
Cannot GET /
浏览器控制台打印
jquery.min.js:562 Refused to apply inline style because it violates the following Content Security Policy directive: "default-src 'self'". Either the 'unsafe-inline' keyword, a hash ('sha256-33YGiROm4Pzv0xXIPo82M0Dt2zrdnP4IgbJq1WeAtf8='), or a nonce ('nonce-...') is required to enable inline execution. Note also that 'style-src' was not explicitly set, so 'default-src' is used as a fallback.
(anonymous) @ jquery.min.js:562
(anonymous) @ jquery.min.js:605
(anonymous) @ jquery.min.js:2462
当我从终端运行npm start
时,网站加载正常。我在vscode中安装了chrome扩展程序。
我的launch.json条目:
{
"type": "node",
"request": "launch",
"name": "xxxx-xxx",
"program": "${workspaceFolder}/xxxx-xxx/server.js",
"env": {"PORT":"6015"}
}
我尝试在不同的浏览器上运行只是为了确保它不是浏览器中的扩展程序,并且在所有浏览器中都得到相同的结果。不知道为什么这可以从终端工作,但不能从vscode内部工作:(。