Javascript DevTools 无法加载 SourceMap:无法加载内容

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/61205390/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 05:22:10  来源:igfitidea点击:

DevTools failed to load SourceMap: Could not load content

javascripthtmldevtools

提问by Edee

My code

我的代码

<html>
  <head>
    <!-- Load TensorFlow.js -->
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script> 
    <!-- Load Posenet -->
    <script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/posenet"></script> 
 </head>

  <body>
    <img id='cat' src='./pose/images/aa_085.jpg'/>
  </body>
  <!-- Place your code in the script tag below. You can also use an external .js file -->
  <script>
    var flipHorizontal = false;

    var imageElement = document.getElementById('cat');

    posenet.load().then(function(net) {
      const pose = net.estimateSinglePose(imageElement, {
        flipHorizontal: true
      });
      return pose;
    }).then(function(pose){
      console.log(pose);
    })
  </script> 
</html>

Rarely use HTML and JS, almost forget the most fundamentals, can any one kindly point out my fool? Error info attached.

很少使用HTML和JS,几乎忘记了最基本的东西,有没有好心人指出我的傻瓜?附上错误信息。

DevTools failed to load SourceMap: Could not load content for https://cdn.jsdelivr.net/npm/@tensorflow/tf.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

DevTools 无法加载 SourceMap:无法加载https://cdn.jsdelivr.net/npm/@tensorflow/tf.min.js.map 的内容:HTTP 错误:状态码 404,net::ERR_HTTP_RESPONSE_CODE_FAILURE

采纳答案by Valeri Voev

This is what worked for me: instead of

这对我有用:而不是

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs"></script>

try

尝试

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs/dist/tf.min.js"> </script>

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs/dist/tf.min.js"> </script>

After that change I am not seeing the error anymore.

在那次更改之后,我不再看到错误。

回答by Gaurav Gupta

While, the fix as per Valeri works, but its only for tfjs.

虽然,按照 Valeri 进行的修复有效,但仅适用于 tfjs。

If you're expecting for body-pix or any other tensor-flow/models, you would be facing the same. It is an open issue too and the team is working on the fix!

如果您期待 body-pix 或任何其他张量流/模型,您将面临同样的问题。这也是一个悬而未决的问题,团队正在修复!

https://github.com/dequelabs/axe-core/issues/1977

https://github.com/dequelabs/axe-core/issues/1977

But, if you don't have problem in degrading the version (if anyone wants to use body-pix) from latest docs, below both links works fine as I've tested the same:

但是,如果您在从最新文档中降级版本(如果有人想使用 body-pix)时没有问题,那么下面的两个链接都可以正常工作,因为我已经测试过相同的内容:

<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]/dist/tf.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/[email protected]"></script> 

回答by Eray ?nler

I had similar problem when i was trying to work with coco-ssd. I think this problem is caused because of the version. I changed version of tfjs to 0.9.0 and coco-ssd version to 1.1.0 and it worked for me. (you can search for posenet versions on : https://www.jsdelivr.com/package/npm/@tensorflow-models/posenet)

当我尝试使用 coco-ssd 时,我遇到了类似的问题。我认为这个问题是由版本引起的。我将 tfjs 版本更改为 0.9.0,将 coco-ssd 版本更改为 1.1.0,它对我有用。(您可以在以下位置搜索posenet版本:https://www.jsdelivr.com/package/npm/@tensorflow-models/posenet )

<!-- Load TensorFlow.js-->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"></script>
<!-- Load the coco-ssd model. -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow-models/[email protected]"</script>