【问题标题】:Is it a problem that web3 gives deprecation warnings?web3 给出弃用警告是否有问题?
【发布时间】:2022-11-11 06:49:15
【问题描述】:
将 web3 作为依赖项会给出弃用通知,例如
npm WARN deprecated @types/keyv@4.2.0: This is a stub types definition. keyv provides its own type definitions, so you do not need this installed.
npm WARN deprecated mkdirp-promise@5.0.1: This package is broken and no longer maintained. 'mkdirp' itself supports promises now, please switch to that.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated multicodec@1.0.4: This module has been superseded by the multiformats module
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated uuid@3.3.2: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated multibase@0.6.1: This module has been superseded by the multiformats module
npm WARN deprecated multibase@0.7.0: This module has been superseded by the multiformats module
npm WARN deprecated multicodec@0.5.7: This module has been superseded by the multiformats module
npm WARN deprecated cids@0.7.5: This module has been superseded by the multiformats module
这是一个问题吗?如果是,我该如何解决?
【问题讨论】:
标签:
node.js
npm
yarnpkg
web3js
【解决方案1】:
该错误可能是由于 .json 文件中的依赖项版本。
我试图使用gatsby 建立一个站点。在网站发布一两个月后,我尝试npm update 并抛出一个与您的非常相似的错误。
npm WARN deprecated multer@1.4.4: Multer 1.x is affected by CVE-2022-24434. This is fixed in v1.4.4-lts.1 which drops support for versions of Node.js before 6. Please upgrade to at least Node.js 6 and version 1.4.4-lts.1 of Multer. If you need support for older versions of Node.js, we are open to accepting patches that would fix the CVE on the main 1.x release line, whilst maintaining compatibility with Node.js 0.10.
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
npm WARN deprecated subscriptions-transport-ws@0.9.19: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated gatsby-recipes@0.25.0: gatsby-recipes has been removed from gatsby/gatsby-cli >=4.5.0. Update to gatsby@latest/gatsby-cli@latest to use versions without gatsby-recipes. This package will no longer receive updates.
然后我发现 npm 有一种非常优雅的方式来显示 .json 文件中提到的依赖版本,使用 npm outdated。像这样的东西:
$ npm outdated
Package Current Wanted Latest Location Depended by
babel-plugin-styled-components 1.13.3 1.13.3 2.0.7 node_modules/babel-plugin-styled-components portfolio-main
babel-preset-gatsby 1.14.0 1.14.0 2.24.0 node_modules/babel-preset-gatsby portfolio-main
eslint 7.32.0 7.32.0 8.26.0 node_modules/eslint portfolio-main
gatsby 3.14.6 3.14.6 4.24.5 node_modules/gatsby portfolio-main
gatsby-plugin-google-analytics 3.14.0 3.14.0 4.24.0 node_modules/gatsby-plugin-google-analytics portfolio-main
gatsby-plugin-image 1.14.2 1.14.2 2.24.0 node_modules/gatsby-plugin-image portfolio-main
gatsby-plugin-manifest 3.14.0 3.14.0 4.24.0 node_modules/gatsby-plugin-manifest portfolio-main
gatsby-plugin-netlify 3.14.0 3.14.0 5.0.1 node_modules/gatsby-plugin-netlify portfolio-main
gatsby-plugin-offline 4.14.0 4.14.0 5.24.0 node_modules/gatsby-plugin-offline portfolio-main
gatsby-plugin-react-helmet 4.14.0 4.14.0 5.24.0 node_modules/gatsby-plugin-react-helmet portfolio-main
gatsby-plugin-sharp 3.14.3 3.14.3 4.24.0 node_modules/gatsby-plugin-sharp portfolio-main
gatsby-plugin-sitemap 4.10.0 4.10.0 5.24.0 node_modules/gatsby-plugin-sitemap portfolio-main
gatsby-plugin-styled-components 4.14.0 4.14.0 5.24.0 node_modules/gatsby-plugin-styled-components portfolio-main
gatsby-remark-images 5.11.0 5.11.0 6.24.0 node_modules/gatsby-remark-images portfolio-main
gatsby-remark-prismjs 5.11.0 5.11.0 6.24.0 node_modules/gatsby-remark-prismjs portfolio-main
gatsby-source-filesystem 3.14.0 3.14.0 4.24.0 node_modules/gatsby-source-filesystem portfolio-main
gatsby-transformer-remark 4.11.0 4.11.0 5.24.0 node_modules/gatsby-transformer-remark portfolio-main
gatsby-transformer-sharp 3.14.0 3.14.0 4.24.0 node_modules/gatsby-transformer-sharp portfolio-main
husky 6.0.0 6.0.0 8.0.1 node_modules/husky portfolio-main
lint-staged 10.5.4 10.5.4 13.0.3 node_modules/lint-staged portfolio-main
react 17.0.2 17.0.2 18.2.0 node_modules/react portfolio-main
react-dom 17.0.2 17.0.2 18.2.0 node_modules/react-dom portfolio-main
在尝试在版本号之前使用^ 之前,我将所有依赖项一一编辑到想要的版本。然后npm update 成功了,没有任何错误。而我的gatsby build 就像一个魅力。
我建议不要担心你的代码,如果问题和我的类似,只是依赖关系一直在更新,我们需要注意版本,或者直接使用^或~,如果你想自动更新。
您可以在npmwebsite 上查看更多详细信息。