如何看待前端项目初始化时大量的警告提示?

265 天前
 maiyasu

我准备开发一个系统,看了一圈,打算用 Ant Desig Pro 来做前端框架。从安装到项目起来,一大坨的各种警告,让我的热情血条已经-50%了。

首先是安装脚手架, 许多警告。

 sudo npm i @ant-design/pro-cli -g
[sudo] password for maiyasu: 
npm WARN deprecated @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
npm WARN deprecated readdir-scoped-modules@1.1.0: This functionality has been moved to @npmcli/fs
npm WARN deprecated debuglog@1.0.1: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated @npmcli/move-file@2.0.1: This functionality has been moved to @npmcli/fs
npm WARN deprecated @stylelint/postcss-markdown@0.36.2: Use the original unforked package instead: postcss-markdown
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated date-format@0.0.0: 0.x is no longer supported. Please upgrade to 4.x or higher.
npm WARN deprecated streamroller@0.4.1: 0.x is no longer supported. Please upgrade to 3.x or higher.
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 @stylelint/postcss-css-in-js@0.37.3: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated log4js@1.1.1: 1.x is no longer supported. Please upgrade to 6.x or higher.
npm WARN deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.

added 223 packages, removed 23 packages, and changed 986 packages in 3m

210 packages are looking for funding
  run `npm fund` for details
  

接着是项目创建好了,使用 yarn 工具初始化,耗费了 10 分钟,也是大量警告。

$ yarn
yarn install v1.22.19
info No lockfile found.
[1/5] Validating package.json...
[2/5] Resolving packages...
warning react-dev-inspector > querystring@0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning react-dev-inspector > react-dev-utils > fork-ts-checker-webpack-plugin > memfs@3.6.0: this will be v4
warning @ant-design/pro-cli > pngjs-image > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning @ant-design/pro-cli > babel-types > babel-runtime > core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning @ant-design/pro-cli > blink-diff > preceptor-core > log4js@1.1.1: 1.x is no longer supported. Please upgrade to 6.x or higher.
warning @ant-design/pro-cli > @umijs/fabric > stylelint > @stylelint/postcss-css-in-js@0.37.3: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
warning @ant-design/pro-cli > @umijs/fabric > stylelint > @stylelint/postcss-markdown@0.36.2: Use the original unforked package instead: postcss-markdown
warning @ant-design/pro-cli > pngjs-image > request > har-validator@5.1.5: this library is no longer supported
warning @ant-design/pro-cli > pngjs-image > request > 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.
warning @ant-design/pro-cli > blink-diff > preceptor-core > log4js > streamroller@0.4.1: 0.x is no longer supported. Please upgrade to 3.x or higher.
warning @ant-design/pro-cli > blink-diff > preceptor-core > log4js > streamroller > date-format@0.0.0: 0.x is no longer supported. Please upgrade to 4.x or higher.
warning @types/classnames@2.3.1: This is a stub types definition. classnames provides its own type definitions, so you do not need this installed.
warning @umijs/lint > @stylelint/postcss-css-in-js@0.38.0: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
warning @umijs/max > umi > @umijs/bundler-webpack > fork-ts-checker-webpack-plugin > memfs@3.6.0: this will be v4
warning @umijs/max > @umijs/plugins > dva-core > flatten@1.0.3: flatten is deprecated in favor of utility frameworks such as lodash.
warning @umijs/max > @umijs/plugins > react-intl > intl-messageformat-parser@3.6.4: We've written a new parser that's 6x faster and is backwards compatible. Please use @formatjs/icu-messageformat-parser
warning @umijs/max > @umijs/plugins > react-intl > intl-messageformat > intl-messageformat-parser@3.6.4: We've written a new parser that's 6x faster and is backwards compatible. Please use @formatjs/icu-messageformat-parser
warning @umijs/max > @umijs/plugins > react-intl > @formatjs/intl-unified-numberformat@3.3.7: We have renamed the package to @formatjs/intl-numberformat
warning @umijs/max > @umijs/plugins > react-intl > intl-messageformat-parser > @formatjs/intl-unified-numberformat@3.3.7: We have renamed the package to @formatjs/intl-numberformat
warning @umijs/max > @umijs/plugins > react-intl > @formatjs/intl-utils@2.3.0: the package is rather renamed to @formatjs/ecma-abstract with some changes in functionality (primarily selectUnit is removed and we don't plan to make any further changes to this package
warning @umijs/max > @umijs/plugins > react-intl > @formatjs/intl-displaynames > @formatjs/intl-utils@2.3.0: the package is rather renamed to @formatjs/ecma-abstract with some changes in functionality (primarily selectUnit is removed and we don't plan to make any further changes to this package
warning @umijs/max > @umijs/plugins > react-intl > @formatjs/intl-listformat > @formatjs/intl-utils@2.3.0: the package is rather renamed to @formatjs/ecma-abstract with some changes in functionality (primarily selectUnit is removed and we don't plan to make any further changes to this package
warning @umijs/max > @umijs/plugins > react-intl > @formatjs/intl-unified-numberformat > @formatjs/intl-utils@2.3.0: the package is rather renamed to @formatjs/ecma-abstract with some changes in functionality (primarily selectUnit is removed and we don't plan to make any further changes to this package
warning @umijs/max > @umijs/plugins > react-intl > @formatjs/intl-relativetimeformat > @formatjs/intl-utils@2.3.0: the package is rather renamed to @formatjs/ecma-abstract with some changes in functionality (primarily selectUnit is removed and we don't plan to make any further changes to this package
warning @umijs/max > umi > @umijs/preset-umi > click-to-react-component > @floating-ui/react-dom-interactions@0.3.1: Package renamed to @floating-ui/react
warning @umijs/max > umi > @umijs/bundler-webpack > @svgr/plugin-svgo > svgo > stable@0.1.8: Modern JS already guarantees Array#sort() is a stable sort, so this library is deprecated. See the compatibility table on MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#browser_compatibility
warning umi-presets-pro > @alita/plugins > antd-mobile-alita > rmc-list-view > fbjs > core-js@1.2.7: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
warning umi-presets-pro > @alita/plugins > antd-mobile-alita > rc-swipeout > react-native-swipeout@2.3.6: Package no longer supported. Use at your own risk or consider using https://github.com/software-mansion/react-native-gesture-handler
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning "@ant-design/pro-components > @ant-design/pro-form@2.18.1" has unmet peer dependency "rc-field-form@^1.22.0".
warning "@ant-design/pro-components > @ant-design/pro-table@3.11.0" has unmet peer dependency "rc-field-form@^1.22.0".
warning "react-dev-inspector > react-dev-utils > fork-ts-checker-webpack-plugin@6.5.3" has unmet peer dependency "webpack@>= 4".
warning "@umijs/lint > stylelint-config-standard@25.0.0" has unmet peer dependency "stylelint@^14.4.0".
warning "@umijs/lint > stylelint-config-standard > stylelint-config-recommended@7.0.0" has unmet peer dependency "stylelint@^14.4.0".
warning "@umijs/lint > @umijs/babel-preset-umi > babel-plugin-styled-components@2.1.1" has unmet peer dependency "styled-components@>= 2".
warning "@umijs/max > umi > @umijs/test > @babel/plugin-transform-modules-commonjs@7.21.2" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "@umijs/max > @umijs/plugins > @ahooksjs/use-request@2.8.15" has incorrect peer dependency "react@^16.8.0 || ^17.0.0".
warning "@umijs/max > umi > @umijs/bundler-webpack > fork-ts-checker-webpack-plugin@8.0.0" has unmet peer dependency "webpack@^5.11.0".
warning "@umijs/max > @umijs/plugins > dva-immer@1.0.1" has unmet peer dependency "dva@^2.5.0-0".
warning "@umijs/max > @umijs/plugins > dva-loading@3.0.24" has incorrect peer dependency "dva-core@^1.1.0 || ^1.5.0-0 || ^1.6.0-0".
warning "@umijs/max > @umijs/plugins > react-intl@3.12.1" has incorrect peer dependency "react@^16.3.0".
warning "@umijs/max > umi > @umijs/preset-umi > html-webpack-plugin@5.5.0" has unmet peer dependency "webpack@^5.20.0".
warning "@umijs/max > umi > @umijs/preset-umi > postcss-prefix-selector@1.16.0" has unmet peer dependency "postcss@>4 <9".
warning "@umijs/max > umi > @umijs/test > babel-jest@29.6.3" has unmet peer dependency "@babel/core@^7.8.0".
warning "@umijs/max > umi > @umijs/bundler-webpack > @pmmmwh/react-refresh-webpack-plugin@0.5.10" has unmet peer dependency "webpack@>=4.43.0 <6.0.0".
warning "@umijs/max > umi > @umijs/bundler-webpack > css-loader@6.7.1" has unmet peer dependency "webpack@^5.0.0".
warning "@umijs/max > umi > @umijs/test > babel-jest > babel-preset-jest@29.6.3" has unmet peer dependency "@babel/core@^7.0.0".
warning "@umijs/max > umi > @umijs/test > babel-jest > babel-preset-jest > babel-preset-current-node-syntax > @babel/plugin-syntax-bigint@7.8.3" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > ts-node@10.9.1" has unmet peer dependency "@types/node@*".
warning "umi-presets-pro > @umijs/request-record@1.1.4" has unmet peer dependency "umi@>=3".
warning Workspaces can only be enabled in private projects.
warning Workspaces can only be enabled in private projects.
[5/5] Building fresh packages...
success Saved lockfile.
$ max setup
😄 Hello PRO
info  - [你知道吗?] 想快速修改 html 模板、DIY 项目?试试编写项目级插件,详见 https://umijs.org/docs/guides/directory-structure#plugints
Using openapi Plugin
info  - generate files
info  - Preparing...
$ husky install
fatal: not a git repository (or any of the parent directories): .git
Done in 610.08s.

这么多提示消息,让我十分焦虑。其它不单单是 AntD ,包括其它的前端项目,也是有很多这样的现象,我就是想问问,是框架的维护者们对此觉得无所谓,忍着就行,还是用户的原因,是我使用姿势不对呢?

其它的语言这种问题好像没有这么明显。

2532 次点击
所在节点    问与答
25 条回复
pengtdyd
265 天前
又不是不能用!
maiyasu
265 天前
@pengtdyd 这让我想起一个笑话,““悬崖边的牌子上写着 Warning ,只有程序员掉了下去。””
leaflxh
265 天前
项目和人有一个能跑就行(

有好多“no longer supported”的包,应该需要换掉
maiyasu
265 天前
@leaflxh 就事论事,是应该用户这边自己使用 npm 来换掉,还是应该架构中的依赖来解决这个问题呢?
leaflxh
265 天前
可能怕万一出了漏洞,没人维护,或者 node 大版本更新后破坏了向前兼容,没人做新版本的适配
leaflxh
265 天前
@maiyasu 谁开发谁治理(
WasteNya
265 天前
很多大公司的产品的主页控制台都那么多警告和报错了,但这与产品的成功与否没有直接关系,能影响的只是我们技术那不值几个钱的洁癖而已。只要锁定版本,保证产品使用正常就可以了
NerbraskaGuy
265 天前
这种版本升级提示不用管,有时候真管了还麻烦,比如之前换 M 芯片 mac 之后好多包的最新版本不兼容搞了半天
potatowish
265 天前
前端的警告不重要,直接无视。写后端倒是比较注意
darkengine
265 天前
前端(React)项目的依赖我是真怕的,老项目升级一个包带动 N 个包依赖出错,还是少动为妙。新项目最好还是都更新上去,毕竟能多苟一阵子。
shyangs
265 天前
我覺得你看的項目太少 C / C++ / Java / PHP / Python 都有這種無視 warning 的情況.

- [对于程序员来说,Warning 真的不重要吗? - 知乎]( https://www.zhihu.com/question/29155164 )
- [既然程序员不管警告,警告对程序员有什么用? - 知乎]( https://www.zhihu.com/question/29642632 )
- [How to disable Python warnings? - Stack Overflow]( https://stackoverflow.com/questions/14463277/how-to-disable-python-warnings )
maiyasu
265 天前
真没有想到,搞前端都是这样的状态吗?真的是负债
plasticman64
265 天前
重要的包多测试一下,然后锁定版本即可
maiyasu
265 天前
@shyangs 其它的项目的依赖没有 js 项目包管理这么糟糕吧。
296727
265 天前
为什么需要管呢?比如说一个东西,他说 10 个版本之后要改版,但是你固定了老版本,他报他的警告,你用你的老版本,功能稳定,为什么要处理?
shyangs
265 天前
@maiyasu

嗯... C / C++ 連包管理都沒有,只能用 cmake (非嚴格意義的包管理). cmake 應該比不過 npm.
maiyasu
265 天前
@shyangs Linux 下搞 C/C++开发,包都很稳定,开发体验不错,apt-get 安装 xxx-dev 这样的库的头文件就完事了。
ericguo
265 天前
楼主要么考虑换 Rails 算了,我这个模版 https://github.com/Eric-Guo/coreui4-rails-starter 现在没有 warning 。

lidashuang
265 天前
用 rails 把,真象
IvanLi127
264 天前
你选了 ant design 还是 pro ,warning 少才奇怪,重新选型吧。
不过每个 node 包更新频率都不一样,是比较容易出现各种的警告。少依赖过时的,更新频率不高的包吧

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/967607

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX