2

I have a problem "Unable to resolve module".

// Please, read the question before publish comments with links for first result from google.

This is the import line where I got the error:

import Interactor from 'react-native-native-orientation-interactor';

What I did:

  1. Create a react-native library
  2. Run npm link inside the library folder
  3. Run npm link react-native-native-orientation-interactor inside a demo react-native app
  4. Add import statement
  5. Got the error with import.

If I press Cmd+B on import statement I can open a file from node_modules folder. Also I can see my library (as a link) inside node_modules.

But I didn't find any solution for me.

Upd1: I added my library as a dependency in package.json

  "dependencies": {
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-native-orientation-interactor": "*"
  },
Artem
  • 4,569
  • 12
  • 44
  • 86

2 Answers2

0

1 - First of all you have written double native in react-native-native-orientation-interaction

2 - Another thing is, don't add dependencies manually.. Use Proper installation guide like

npm install --save react-native-orientation-interactor or yarn add react-native-orientation-interactor

then link the dependency.

3 - And actually I didn't get any module named 'react-native-orientation-interaction'.

react-native-orientation

here is the one of valid module dependency. always read the whole proper Documentation.( Correct me if I am wrong)

Vanns35
  • 466
  • 4
  • 15
  • 1
    Hi, thank for your answer, really there is double-native) my mistake, but the library and demo app are local projects and I'm not publish the library into npm yet. So I can't to install the dependency by npm install – Artem Feb 18 '20 at 13:44
0

If you are able to link your package correctly, and problem still persists.

From my experience you can do two things to resolve error.
1) Try to install pod in ios/ directory
or
2) Just close the Termianl and re-run