Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Error: Can't resolve 'fs' - installation #104

Closed
informatter opened this issue Nov 30, 2023 · 3 comments
Closed

Module not found: Error: Can't resolve 'fs' - installation #104

informatter opened this issue Nov 30, 2023 · 3 comments

Comments

@informatter
Copy link

Hi everyone,

I am trying to install the ogr2ogr in a Vue 2.7.14. Initially it "successfully" installed after running npm install ogr2ogr

After adding import ogr2ogr from 'ogr2ogr' to a vue component to test the installation, my app fails to build due to the below polyfill errors:

  • path-browserify
  • browserify-zlib
  • constants-browserify
  • stream-browserify
  • os-browserify/browser

To mitigate the issue, I added the following to webpack.config.js to ignore the polyfills for the above

    resolve:{
      fallback:{
        "os":false,
        "constants":false,
        "path":false,
        "stream":false,
        "zlib":false
      }
    }

After rebuilding the app, polyfill errors are gone as expected, but now I am seeing the following errors:

 ERROR  Failed to compile with 7 errors                                                                                                                                                                              3:44:52 PM

 error  in ./node_modules/archiver/lib/core.js

Module not found: Error: Can't resolve 'fs' in '/Users/hammer-dev-003/Documents/HammerMissions/hub/node_modules/archiver/lib'

 error  in ./node_modules/fs.realpath/index.js

Module not found: Error: Can't resolve 'fs' in '/Users/hammer-dev-003/Documents/HammerMissions/hub/node_modules/fs.realpath'

 error  in ./node_modules/glob/common.js

Module not found: Error: Can't resolve 'fs' in '/Users/hammer-dev-003/Documents/HammerMissions/hub/node_modules/glob'

 error  in ./node_modules/graceful-fs/graceful-fs.js

Module not found: Error: Can't resolve 'fs' in '/Users/hammer-dev-003/Documents/HammerMissions/hub/node_modules/graceful-fs'

 error  in ./node_modules/readdir-glob/index.js

Module not found: Error: Can't resolve 'fs' in '/Users/hammer-dev-003/Documents/HammerMissions/hub/node_modules/readdir-glob'

 error  in ./node_modules/ogr2ogr/dist/esm/index.js

Module not found: Error: Can't resolve 'child_process' in '/Users/hammer-dev-003/Documents/HammerMissions/hub/node_modules/ogr2ogr/dist/esm'

 error  in ./node_modules/ogr2ogr/dist/esm/index.js

Module not found: Error: Can't resolve 'fs' in '/Users/hammer-dev-003/Documents/HammerMissions/hub/node_modules/ogr2ogr/dist/esm'

But I am not sure why the fs is not being found?

@wavded
Copy link
Owner

wavded commented Dec 1, 2023

I am not a Vue user, but it seems to be a frontend JS framework. ogr2ogr has to run on the server side to work.

@ralyodio
Copy link

ralyodio commented Dec 3, 2023

you need to create an api endpoint that has access to your server's filesystem.

@informatter
Copy link
Author

Ok cool makes sense!

@wavded wavded closed this as completed Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants