Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm list does not show installed package

Tags:

node.js

npm

I'm having trouble understanding npm. I have a node.js project with react, but I am not able to find the latter with npm list.

I certainly have it installed, because my project using react works.

I also have it in my package.json file under "dependencies":

"dependencies": {
    "react": "^16.4.1"
}

Also, if I search for react on my drive, I find the module for it in my project folder:

user/Dev/project/node_modules/react

However, if I do npm list react, I get nothing:

me ~/D/project> npm list react
[email protected] /Users/me/Dev/project
└── (empty)

Even if I do npm install or even specifically npm install react --save, no change.

Nor is the package listed with npm list or npm list -g (with or without --depth=0), except I get further indications that npm does not 'see' the react module:

UNMET PEER DEPENDENCY [email protected]

I'm using npm v5.6.0.

Any ideas?

like image 449
artooras Avatar asked Jul 30 '18 07:07

artooras


People also ask

How do I list installed npm packages?

Now, to check the list of npm user-installed packages. We have to make use of the “npm-list” command in the current working directory where the npm is installed. Every installed package will be installed in the tree-like structure.

Why is my npm list empty?

This error happens when there are missing packages in your node_modules/ folder that prevents the development server from running. To solve this error, you need to make sure that you have the node_modules/ folder generated by the npm install command.

How do you check npm package is installed or not?

To discover npm version checks are currently installed in your project, run npm list. All the npm modules available are: the latest version of [email protected]. This [email protected].

Where is my npm package installed?

Local Installation of Packages: Local packages are installed in the directory where you run npm install <package-name> and they are put in the node_modules folder under this directory.


1 Answers

I fixed this by running npm update command. (If that doesn't work try to delete node_modules and package-lock.json prior to running npm_update)

like image 91
croraf Avatar answered Oct 21 '22 21:10

croraf