简体   繁体   English

NPM 关于已弃用包的警告消息

[英]NPM warn message about deprecated package

I am installing a module globally我正在全局安装一个模块

$ npm install -g X

and NPM says和 NPM 说

"npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0" “npm WARN 已弃用 lodash@1.0.2: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。)。

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.此命令将分析已安装的 NPM 包及其版本。 The report will contain:该报告将包含:

  1. package name包裹名字
  2. latest version最新版本
  3. current version当前版本
  4. dependency path (down to depth level)依赖路径(向下到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.有一个很棒的 npm 包: npm-check ,它允许检查过时的依赖项。 Probably大概

My favorite feature: Interactive Update — run npm-check -u in the project folder.我最喜欢的功能:交互式更新——在项目文件夹中运行npm-check -u An interactive menu shows all required information about dependencies in the current folder and allows to update all dependencies in 3 seconds.交互式菜单显示有关当前文件夹中依赖项的所有必需信息,并允许在 3 秒内更新所有依赖项。

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> ,做了类似的事情,但给你的细节更少

Use npm list .使用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.也许将输出重定向到文件或 grep 以便您可以更轻松地搜索它。

用这个

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

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

For deprecated files you should use the "npm i [package]" syntax, in this case you should use: npm i X and it will fetch all necessary packages, including deprecated ones, but which are required for your installation.对于不推荐使用的文件,您应该使用“npm i [package]”语法,在这种情况下,您应该使用:npm i X,它将获取所有必要的包,包括不推荐使用的包,但这些包是您的安装所必需的。

Npm documentation link: https://docs.npmjs.com/using-deprecated-packages Npm 文档链接: https ://docs.npmjs.com/using-deprecated-packages

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

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