Looking for ?

Translate

Solution - Error: Package subpath ./index is not defined by exports in projectPath node_modules event target shim package.json

 Hello tech guys and girls, if you are encountering this error ( Package subpath './index' is not defined by "exports" in projectPath\node_modules\event-target-shim\package.json ) whenever you want to run your react native project, here is the Solution:



SOLUTION

1. Locate node_modules/event-target-shim/package.json:

Open the package.json file of event-target-shim in the path:

C:\wamp64\www\projectPath\node_modules\event-target-shim\package.json


2. Check the exports field:

In the package.json, there should be an exports field that may look something like this:


"exports": {

  "./index": "./index.js"

}


3. If it's missing or incomplete, the error you're seeing could be a result of that.


Add or modify the exports field:

You can manually try to add an exports field that resolves the ./index subpath. Modify it to include the index.js file, like so:


"exports": {

  "./index": {

    "import": "./index.mjs",

    "require": "./index.js"

  },

  ".": {

    "import": "./index.mjs",

    "require": "./index.js"

  }

...Other imports if exists in existing exports section

}


4. When the above has been done, run the below command to clear cache

npm cache clean --force


5. Then run this to build again: npx expo run:android 


SHARE THIS POST

About Wakabia

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment