skip to Main Content

enter image description here

I am getting error for module that doesn’t even exist in Package.json file. what is that and how to resolve this problem

usually i try deleting node modules and then npm install but this time i did it and got this error again

2

Answers


  1. If you want to use this library then you have to install it using

    npm i @twotalltotems/react-native-otp-input

    Now as u said : " module that doesn’t even exist in Package.json file" and you are still importing the library e.g

    "import OTPInputView from ‘@twotalltotems/react-native-otp-input’"

    thats why it’s giving the error.

    just remove this line "import OTPInputView from ‘@twotalltotems/react-native-otp-input’"

    Secondly You don’t need to delete node modules every time. It should be done only in swear cases.

    you can simple try npm start –Reset-cache

    if you have any other confusion ,feel free to ask

    Login or Signup to reply.
  2. "npm install" only installs packages mentioned under package.json file.

    As you are getting an error for the module which is not present under package.json, you are supposed to add that module name in package.json file as other modules are mentioned under "dependencies" object.
    And after adding the module name you can try "npm install".

    Or

    You can simply try npm install for that respective package separately, it’ll automatically add that module name in package.json and will install the same for you.

    for example:
    let’s suppose you are getting an error for a package called as ‘example’

    npm install example

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search