node.js 关于已弃用的软件包的 NPM 警告消息

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35236735/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 19:52:30  来源:igfitidea点击:

NPM warn message about deprecated package

node.jsnpm

提问by Alexander Mills

I am installing a module globally

我正在全局安装一个模块

$ npm install -g X

and NPM says

和 NPM 说

"npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0"

“npm WARN 已弃用 [email protected]:lodash@<3.0.0 不再维护。升级到 lodash@^4.0.0”

how can I find out which module has an dependency on this old version of lodash?

如何找出哪个模块依赖于这个旧版本的 lodash?

The warning message from NPM doesn't seem to give me any clue which module references this old version (I believe that the module X does not have a direct dependency on this old version of lodash.).

来自 NPM 的警告消息似乎没有给我任何线索,哪个模块引用了这个旧版本(我相信模块 X 没有直接依赖于这个旧版本的 lodash。)。

采纳答案by Alexander Mills

npm la <package-name> 

also works, and will give you the most details about the dependency graph of a dependency.

也可以工作,并将为您提供有关依赖项的依赖关系图的最详细信息。

npm ls <package-name>, does something similar but gives you less details

npm ls <package-name>, 做一些类似的事情,但给你的细节更少

回答by maxkoryukov

I got an answer for the similar question: https://stackoverflow.com/a/36335866/1115187

我得到了类似问题的答案:https: //stackoverflow.com/a/36335866/1115187

Briefly:

简要地:

npm outdated --depth=3

This command will analyze installed NPM-packages and their versions. The report will contain:

此命令将分析已安装的 NPM 包及其版本。报告将包含:

  1. package name
  2. latest version
  3. current version
  4. dependency path (down to depthlevel)
  1. 包裹名字
  2. 最新版本
  3. 当前版本
  4. 依赖路径(向下到depth级别)

Hope, this information could help you to gather info about outdated packages.

希望这些信息可以帮助您收集有关过时软件包的信息。

Next step - get in touch with maintainers of the appropriate package, and ask them to update the package (maybe, you would like to send a pull request).

下一步 - 与相应包的维护者联系,并要求他们更新包(也许,您想发送拉取请求)。

UPD: npm-check

UPD:npm 检查

There is a great npm package: npm-check, that allows checking outdated dependencies. Probably

有一个很棒的 npm 包:npm-check,它允许检查过时的依赖项。大概

My favorite feature: Interactive Update— run npm-check -uin the project folder. An interactive menu shows all required information about dependencies in the current folder and allows to update all dependencies in 3 seconds.

我最喜欢的功能:交互式更新——npm-check -u在项目文件夹中运行。交互式菜单显示有关当前文件夹中依赖项的所有必需信息,并允许在 3 秒内更新所有依赖项。

回答by zero298

Use npm list. It will print out all of the packages your module depends on as well as your dependencies dependencies and so forth. Maybe redirect output to a file or grep it so you can search it more easily.

使用npm list. 它将打印出您的模块所依赖的所有包以及您的依赖项等。也许将输出重定向到一个文件或 grep 它,以便您可以更轻松地搜索它。

回答by d512

You could search through all the package.json files under node_modules and see which ones are dependent on lodash 1.0.2.

你可以搜索 node_modules 下的所有 package.json 文件,看看哪些依赖于 lodash 1.0.2。

回答by Jose Antonio Amieva Cardoso

use this

用这个

sudo npm install --unsafe-perm -g expo-cli