简体   繁体   English

npm list 不显示已安装的包

[英]npm list does not show installed package

I'm having trouble understanding npm .我在理解npm遇到问题。 I have a node.js project with react , but I am not able to find the latter with npm list .我有一个带有reactnode.js项目,但我无法通过npm list找到后者。

I certainly have it installed, because my project using react works.我当然安装了它,因为我使用react项目有效。

I also have it in my package.json file under "dependencies":我在“依赖项”下的package.json文件中也有它:

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

Also, if I search for react on my drive, I find the module for it in my project folder:另外,如果我在我的驱动器上搜索react ,我会在我的项目文件夹中找到它的模块:

user/Dev/project/node_modules/react

However, if I do npm list react , I get nothing:但是,如果我执行npm list react ,我将一无所获:

me ~/D/project> npm list react
project@0.1.0 /Users/me/Dev/project
└── (empty)

Even if I do npm install or even specifically npm install react --save , no change.即使我执行npm install甚至专门npm install react --save ,也没有变化。

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:包也没有与npm listnpm list -g (有或没有--depth=0 )一起npm list -g ,除非我得到进一步的迹象表明npm没有“看到” react模块:

UNMET PEER DEPENDENCY react@16.4.1

I'm using npm v5.6.0 .我正在使用npm v5.6.0

Any ideas?有任何想法吗?

I fixed this by running npm update command.我通过运行npm update命令修复了这个问题。 (If that doesn't work try to delete node_modules and package-lock.json prior to running npm_update ) (如果这不起作用,请尝试在运行npm_update之前删除node_modulespackage-lock.json npm_update

I'm having trouble understanding npm .我在理解npm遇到问题。 I have a node.js project with react , but I am not able to find the latter with npm list .我有一个带有reactnode.js项目,但是我无法通过npm list找到后者。

I certainly have it installed, because my project using react works.我当然已经安装了它,因为我的项目使用react可以工作。

I also have it in my package.json file under "dependencies":我的package.json文件中的“ 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:另外,如果我在驱动器上搜索react ,则可以在我的项目文件夹中找到它的模块:

user/Dev/project/node_modules/react

However, if I do npm list react , I get nothing:但是,如果我执行npm list react ,那么我什么也没得到:

me ~/D/project> npm list react
project@0.1.0 /Users/me/Dev/project
└── (empty)

Even if I do npm install or even specifically npm install react --save , no change.即使我执行npm install或什至专门执行npm install react --save ,也不会更改。

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:软件包也没有列出npm listnpm list -g (带有或不--depth=0 ),除了我进一步表明npm没有“看到” react模块:

UNMET PEER DEPENDENCY react@16.4.1

I'm using npm v5.6.0 .我正在使用npm v5.6.0

Any ideas?有任何想法吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM