I've been developing a package in node using typescript. When I install the package locally (i.e. providing the local path to the directory of the package, $ npm install ../my_package) everything works fine.
But I've published the package in npm and now when I install the same package from npm it shows me the above-mentioned error:
Cannot use import statement outside a module
I could not find a solution to my problem anywhere. I would really appreciate it if anyone could help me out here.