Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

Unable to resolve module #23

Closed
mtapdilli opened this issue Dec 1, 2020 · 4 comments
Closed

Unable to resolve module #23

mtapdilli opened this issue Dec 1, 2020 · 4 comments
Assignees

Comments

@mtapdilli
Copy link

error: Error: Unable to resolve module ../Observable from node_modules\rxjs\internal\observable\ConnectableObservable.js: ../Observable could not be found within the project or in these directories:
.
........

I had setup two sample repo for you try out Jack :

without Nx : https://github.com/mtapdilli/rntsrx

with Nx : https://github.com/mtapdilli/rntsrx_nx

It's a basic app and I have just added the 'rxjs' library and added below code in App.tsx file . When the app runs/compiles fine, which it does in the repo without Nx, it just prints 'Value is hi' to console. But it is giving the error I have mentioned above. if I comment out these lines then it works fine. Please have a look.

import {Observable} from 'rxjs'
const observable$ = new Observable(function subscribe(subscriber) {
  const intervalId = setInterval(() => {
    subscriber.next('hi');
    subscriber.complete()
    clearInterval(intervalId);
  }, 1000);
});
observable$.subscribe(
  value => console.log(`Value is ${value}`),
  err => console.log(err)
)

Env :
Windows 10
Nx --version : 10.4.4
"@nrwl/react-native": "^10.4.6"

@mtapdilli
Copy link
Author

@jaysoo this seems to working fine in Linux. Not sure if it has something to do with the platform.

For my part I am running nx run-android rntsrx_nx --port=9000 [port 8081 is blocked in my system] in my windows machine and it's giving me the error

@mtapdilli mtapdilli changed the title Using Observable / RxJS Unable to resolve module : Using Observable / RxJS Dec 1, 2020
@mtapdilli
Copy link
Author

@jaysoo I have just tried with other libraries like @react-navigation/stack or @react-navigation/native. Getting same error. It just seems to be a generic issue I am facing. Not related to rxjs/Observable

@mtapdilli mtapdilli changed the title Unable to resolve module : Using Observable / RxJS Unable to resolve module Dec 1, 2020
@jaysoo jaysoo self-assigned this Dec 1, 2020
@jaysoo
Copy link
Member

jaysoo commented Dec 3, 2020

@mtapdilli Very strange. I'm going to have to test it out on a Windows machine, but it does work with Linux and Mac..

@jaysoo
Copy link
Member

jaysoo commented Dec 4, 2020

This should be fixed in 10.4.8-beta.7 (I will cut a full release soon). There was a problem in our custom resolver when passing the module path to the original metro resolver (using module name vs real module name).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants