nchaulet / node-geocoder

nodejs geocoding library
http://nchaulet.github.io/node-geocoder/
MIT License
926 stars 213 forks source link

Compilation errors #343

Closed ivarnakken closed 1 year ago

ivarnakken commented 1 year ago

Hi, @nchaulet! I'm unable to use this library due to the following compilation error:

Compiled with problems:

ERROR in ./node_modules/node-geocoder/lib/error/httperror.js 1:11-26

Module not found: Error: Can't resolve 'util' in '/home/ivar/Documents/div/hackathon/Code2025/app/node_modules/node-geocoder/lib/error'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "util": require.resolve("util/") }'
    - install 'util'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "util": false }

This following was logged in the console:

httperror.js:1 Uncaught Error: Cannot find module 'util'
    at webpackMissingModule (httperror.js:1:1)
    at ./node_modules/node-geocoder/lib/error/httperror.js (httperror.js:1:1)
    at options.factory (react refresh:6:1)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
    at ./node_modules/node-geocoder/lib/httpadapter/fetchadapter.js (fetchadapter.js:3:1)
    at options.factory (react refresh:6:1)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
    at ./node_modules/node-geocoder/lib/geocoderfactory.js (geocoderfactory.js:6:1)
    at options.factory (react refresh:6:1)
    at __webpack_require__ (bootstrap:24:1)
    at fn (hot module replacement:62:1)
    at ./node_modules/node-geocoder/index.js (index.js:3:1)
    at options.factory (react refresh:6:1)
    at __webpack_require__ (bootstrap:24:1)

Is this something you've seen before?

I'm using react-scripts v5 and node v16.

nchaulet commented 1 year ago

Hi @ivarnakken This library is not mean to be used client side only in a nodejs environment.