I have created a PCF (Powerapps Component Framework) in which I am using the GEOCODE feature. I have installed the required components using "npm install node-geocoder" and have added the below code :

let nodeGeocoder = require('node-geocoder');
 
let options = {
  provider: 'openstreetmap'
};
 
let geoCoder = nodeGeocoder(options);
geoCoder.geocode('Luray Caverns')
  .then((res)=> {
    console.log(res[0].latitude);
    console.log(res[0].longitude);
  })
  .catch((err)=> {
    console.log(err);
  });

When i build this code using "npm run build", the build fails with following error: ERROR in ./node_modules/request/lib/har.js Module not found: Error: Can't resolve 'fs' in 'D:\PCF\Demo\node_modules\request\lib'

Module not found: Error: Can't resolve 'net' in 'D:\PCF\Demo\node_modules\forever-agent' ERROR in ./node_modules/node-geocoder/lib/geocoder/agolgeocoder.js Module not found: Error: Can't resolve 'net' in 'D:\PCF\Demo\node_modules\node-geocoder\lib\geocoder'

ERROR in ./node_modules/node-geocoder/lib/geocoder/datasciencetoolkitgeocoder.js Module not found: Error: Can't resolve 'net' in 'D:\PCF\Demo\node_modules\node-geocoder\lib\geocoder'

ERROR in ./node_modules/node-geocoder/lib/geocoder/abstractgeocoder.js Module not found: Error: Can't resolve 'net' in 'D:\PCF\Demo\node_modules\node-geocoder\lib\geocoder'

Any help would be helpful.

Thanks in advance.

0

There are 0 answers