-->

Unable to resolve module…does not exist in the has

2019-07-15 04:07发布

问题:

I am a beginner on ReactNative, I am creating a Twitter clone to practice.

I had already developed a first application and I had no problem.

But since I started the new project, after adding custom modules in the project I have this error message.

In this case I want to import a style sheet into my custom Tweet component, I added a capture, it's better for you.

Screenshot - error message

So, I followed all the instructions of the capture, except Watchmen because I'm working on Windows 10, after doing the procedure, I recreated a new project with "react-create-app", restart XDE expo and the application but the problem comes back ...

I also tried the Github procedure dealing with the problem (see the catch for the issue) here => https://github.com/facebook/react-native/issues/4968

回答1:

Simply follow again below steps

yarn add react-native-tweet-view
react-native link react-native-tweet-view


回答2:

check the top of your file so that you have not imported

import { threadId } from 'worker_threads';

I removed that and it worked



回答3:

There is 3 issue in your import :

  1. You must not write the extension of the module you're importing
  2. Your file is named "Tweet.style" and you try to import "Tweet.styles"
  3. You have to import the relative path of your module

Correct import should be :

import styles from './Tweet.style'