PapaPete
PapaPete

Reputation: 461

React: Module not found: Can't resolve 'react-firebase'hooks' in 'C:\Users\<Name>\Web Dev\Firechat\firechat\src'

So I am attempting to make a web app with React, Firebase, and the react-firebase-hooks module and I can't even get my code to compile. I have uninstalled react-firebase-hooks at least 3 times now and re-installed it just the same. I even installed it globally. My output from npm list is:

npm list

Firebase resolves fine and there are no issues, so it can't be that something isn't installed. In my code, I am using:

import {useAuthState} from 'react-firebase-hooks';
import {useCollectionData} from 'react-firebase-hooks/firestore';

To import useAuthState and useCollectionData from react-firebase-hooks.

Has anyone else had any issues with this? Is this some sort of compatibility issue that I'm not noticing? I also created a totally separate project running

npx create-react-app test

and then

cd test

followed by

npm install --save react-firebase-hooks 

, imported the same 2 components from that module, ran my code with

npm start

and got the same error as I did in my actual app.

I also used

rm -rf node_modules

and then ran

npm install

to no avail.

I am fairly new to the web dev world as well as React and Firebase so please forgive me if I'm overlooking something here.

Upvotes: 4

Views: 7387

Answers (1)

Oluwatowo Rosanwo
Oluwatowo Rosanwo

Reputation: 371

The useAuthState comes from "react-firebase-hooks/auth" modeule, that's why it's not working

Upvotes: 17

Related Questions