[FIXED] How do I use newly installed modules in React when they do not appear in the package.json "dependencies" list?


[Updated my question to give more details]

I am quite new at working with React so this maybe a basic question. I installed several modules I will use one as an example for clarity which was @react-google-maps/api

In my PCs terminal I wrote the following for the install:

npm i -S @react-google-maps/api

When I check in the terminal using:

npm ls --depth=0

I see the module is present in the list it returns. (I have Node.js version 16.14.2 and npm version 8.11.0)

When I open my React app (created using the create-react-app template) I do not see the module listed under dependencies or in the node-modules list.

Since I am some trouble using the contents of this module I was hoping someone might advise if there is something I did wrong in the install or need to do before trying to import components from it.


Honestly this happens all the time to me — not knowing much about your local environment, I would wager that you’re likely not in your project’s directory and are probably installing it globally.

If you’re using VS code, you can just open the terminal in it, but if you’re not go ahead and move to the directory that is at the same root level as your package.json. Then do your npm install [DEPENDENCY YOU WANT]

It should work!

Answered By – Taha Bashir

Answer Checked By – Marilyn (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published