Peerjs: Failed to load sourceMap error

Created on 6 Jul 2020  ·  5Comments  ·  Source: peers/peerjs

While trying a simple code I'm getting this error:

DevTools failed to load SourceMap: Could not load content for https://unpkg.com/peerjs.min.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

My Code

<!DOCTYPE html>
<html lang="">
  <head>
    <meta charset="utf-8">
    <title> Peer JS </title>
    <script src="https://unpkg.com/[email protected]/dist/peerjs.min.js"></script>
  </head>
  <body>
    Peer JS Test
  </body>

  <script>
    let peer = new Peer();

    peer.on('open', function(id) {
        alert('My peer ID is: ' + id);
    });

  </script>
</html>

> 

Most helpful comment

I think i know what the problem is.. (i'm new to this so feel free to correct me)

I opened the link to the js file.. and found that the url to the sourceMappingfile at the end was /peerjs.min.js.map
so I tried to visit https://unpkg.com/[email protected]/dist/peerjs.min.js.map and apparently that link does not exist..
I checked for the latest peerjs file sourcemap using this link and found that it was 1.2.0 (i think this is the latest as of now?)
So then i checked the url: https://unpkg.com/[email protected]/dist/peerjs.min.js.map (notice the version)
and it worked ..
So either the either the sourceMapping url in the original file must be changed or the url that it points to must be available..

Simplest fix i think would be to use the https://unpkg.com/[email protected]/dist/peerjs.min.js (the old version )(i haven't used it though)

Another way to fix this would be (but not sure i'ts okay to do this..)

  1. download the [peerjs.min.js] (https://unpkg.com/[email protected]/dist/peerjs.min.js)
  2. download the peerjs.min.js.map (the old version)
  3. include these downloaded file in your html
    Note that the two files must be in the same folder else you have to edit the peerjs.min.js file and edit the //#sourceMappingURL=/peerjs.min.js.map to //# sourceMappingURL=<path to the map file>

All 5 comments

Same.

:) Ha ha

peerjs.min.js Devtools peerjs.min.js.map error #681

same issue

I think i know what the problem is.. (i'm new to this so feel free to correct me)

I opened the link to the js file.. and found that the url to the sourceMappingfile at the end was /peerjs.min.js.map
so I tried to visit https://unpkg.com/[email protected]/dist/peerjs.min.js.map and apparently that link does not exist..
I checked for the latest peerjs file sourcemap using this link and found that it was 1.2.0 (i think this is the latest as of now?)
So then i checked the url: https://unpkg.com/[email protected]/dist/peerjs.min.js.map (notice the version)
and it worked ..
So either the either the sourceMapping url in the original file must be changed or the url that it points to must be available..

Simplest fix i think would be to use the https://unpkg.com/[email protected]/dist/peerjs.min.js (the old version )(i haven't used it though)

Another way to fix this would be (but not sure i'ts okay to do this..)

  1. download the [peerjs.min.js] (https://unpkg.com/[email protected]/dist/peerjs.min.js)
  2. download the peerjs.min.js.map (the old version)
  3. include these downloaded file in your html
    Note that the two files must be in the same folder else you have to edit the peerjs.min.js file and edit the //#sourceMappingURL=/peerjs.min.js.map to //# sourceMappingURL=<path to the map file>

worked, thank you

Thanks I'm not getting the error anymore

Was this page helpful?
0 / 5 - 0 ratings