Elius94 / react-photo-sphere-viewer

Photosphere Viewer for React.JS
MIT License
69 stars 21 forks source link

[Bug]: Failed to parse source map #48

Closed Oleksl888 closed 9 months ago

Oleksl888 commented 9 months ago

What happened?

Trying to run library in test react app as described in example and it doesn't render anything. These are the dependencies versions that I use: "react": "^18.2.0", "react-dom": "^18.2.0", "react-photo-sphere-viewer": "^4.2.1-psv5.6.0", Getting the following error:

WARNING in ./node_modules/react-photo-sphere-viewer/dist/index.js Module Warning (from ./node_modules/source-map-loader/dist/cjs.js): Failed to parse source map from '/home/.../photo-share-test/node_modules/react-photo-sphere-viewer/src/index.tsx' file: Error: ENOENT: no such file or directory, open '/home/.../photo-share-test/node_modules/react-photo-sphere-viewer/src/index.tsx'

Same error appears when I use .js or .tsx files in two separate projects.

What should have happened?

Must render panorama.

Code


import './App.css';

function App() {
  return (
    <div className="App">
          <ReactPhotoSphereViewer src="./pano_1.jpg" height={'100vh'} width={"100%"}></ReactPhotoSphereViewer>
    </div>
  );
}

export default App;```

### Sandbox Link

_No response_

### Library Version

latest

### What operating system are you using?

Ubuntu

### What browser are you using?

Chrome

### Logs

_No response_

### Interest to fix the bug

- [ ] I would like to fix this bug!
Elius94 commented 9 months ago

Hello! I think that in your case there's a relation with this #3 Simply delete react and react-dom from the node modules of the library

Oleksl888 commented 9 months ago

Thank you for the reply! But it didn't help. Now I get the bellow error:

node:internal/modules/cjs/loader:1042 throw err; ^

Error: Cannot find module 'react' Require stack:

  • /home/.../photo-share-test/node_modules/react-scripts/scripts/start.js at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15) at Function.resolve (node:internal/modules/cjs/helpers:109:19) at Object. (/home/.../photo-share-test/node_modules/react-scripts/scripts/start.js:43:31) at Module._compile (node:internal/modules/cjs/loader:1218:14) at Module._extensions..js (node:internal/modules/cjs/loader:1272:10) at Module.load (node:internal/modules/cjs/loader:1081:32) at Module._load (node:internal/modules/cjs/loader:922:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [ '/home/.../photo-share-test/node_modules/react-scripts/scripts/start.js' ] }

I tried to install dependencies from the package.json that is in your sandbox (with earlier libraries versions) and also tried in latest ones. Also a friend of mine ran it on her machine and it didn't work either. Any suggestions what else can be done?

Elius94 commented 9 months ago

Hey. It seems that something is wrong in your implementation. It should be really easy to boot up this. https://codesandbox.io/p/sandbox/snowy-snowflake-rygxfk?file=%2Fsrc%2FApp.js

Please check if something is different with this sandbox and let me know!

Oleksl888 commented 9 months ago

I don't have access to that sandbox of yours :(

I tried to run a example in this sandbox and still nothing. Maybe you could have a quick look if possible? https://codesandbox.io/p/sandbox/test-photo-sphere-vr2ffh

Elius94 commented 9 months ago

./pano_1.jpg should be placed in "public" not in "src" ;)

Oleksl888 commented 9 months ago

Yes, boss that was it! I must say error messages that I got has been a bit counterintuitive to me. Thank you for your help and quick responses! I owe you a Peroni!

Elius94 commented 9 months ago

I'm glad to hear that! Nice :) Thanks