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?
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.
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.
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].
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.
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
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With