Nodejs required googletrans is giving Error [ERR_PACKAGE_PATH_NOT_EXPORTED]... is not defined by "exports"

77 Views Asked by At

I am new to discord app development. I was following a youtube tutorial for creating a google translation bot written in python. I dont know python language so I opted for Nodejs development.

As you can see from screenshot, it is giving me this error when I uses the following codes in my file. Which ever line of require I use, same error is given.

const { gt } = require('googletrans').default;

OR

const { gt } = require('googletrans');

OR

const gt = require('googletrans').default;

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/adapters/http' is not defined by "exports".

If I donot use this require code my app works. It reads and replies to commands. But when I put any of these lines I get error. I have searched, for days, on the internet, and read many articles and questions on this website. I still cant find the solution. I have read this axios webpage completely and I cant find solution for the error. https://github.com/axios/axios/issues/5264

I have installed googletrans from npm. I have removed and reinstalled it. Nothing changes.

I have seen this require work in youtube videos using python language. Problem is I am not expert programmer in NodeJS. I am new. I need help with this proble.

How do I add http in exports? How do I remove this error and use googletrans. I have tried to use free-translate too but it is also not working. How can I use free-translate or googletrans without path errors. enter image description here [enter image description here](https://i.stack.imgur.com/MFGRe.png)

0

There are 0 best solutions below