清理盖茨比5.2为“react-server-dom-webpack”安装抛出“NPM WARN”标志

hfsqlsce  于 2022-12-19  发布在  React
关注(0)|答案(1)|浏览(149)

在使用Gatsby CLI干净地安装Gatsby 5.2之后,我需要帮助来理解我的终端输出,它显示了大量的NPM WARN标志。

    • 我有三个问题:**

1.这些错误的原因是什么?
1.为什么全新安装会出现这些错误?
1.解决此类问题的首选方法是什么?
我在S.O.上问这些问题是因为我想先发制人地学习如何正确地理解和处理它们。
我在S.O.上阅读了一些类似的问题,有些建议使用--legacy-peer-deps标志。
我理解为什么一般情况下有人会使用--legacy-peer-deps标志,但我很难理解为什么一个新版本,即(Gatsby 5.0),需要使用--legacy-peer-deps
NPM的错误仍然是我的痛点,所以我在寻找容易理解的阅读材料。或者一个全面的解释如果可能的话。

    • 运行后:gatsby info --clipboard**
% gatsby info --clipboard

  System:
    OS: macOS 13.0.1
    CPU: (16) x64 Intel(R) Xeon(R) W-2140B CPU @ 3.20GHz
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
    npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
  Browsers:
    Chrome: 108.0.5359.98
    Safari: 16.1
  npmPackages:
    gatsby: ^5.2.0 => 5.2.0
    gatsby-plugin-image: ^3.2.0 => 3.2.0
    gatsby-plugin-manifest: ^5.2.0 => 5.2.0
    gatsby-plugin-sharp: ^5.2.0 => 5.2.0
    gatsby-source-filesystem: ^5.2.0 => 5.2.0
    gatsby-transformer-sharp: ^5.2.0 => 5.2.0
  npmGlobalPackages:
    gatsby-cli: 5.2.0

%
    • 运行后的预期结果:npm i**
% npm i

removed 1505 packages, and audited 83 packages in 8s

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

found 0 vulnerabilities
%
    • 运行后的实际结果:npm i**
% npm i
npm WARN ERESOLVE overriding peer dependency
npm WARN While resolving: react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
npm WARN Found: react@18.2.0
npm WARN node_modules/react
npm WARN   react@"^18.2.0" from the root project
npm WARN   10 more (react-dom, gatsby, gatsby-plugin-image, ...)
npm WARN 
npm WARN Could not resolve dependency:
npm WARN peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
npm WARN node_modules/react-server-dom-webpack
npm WARN   react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@5.2.0
npm WARN   node_modules/gatsby
npm WARN 
npm WARN Conflicting peer dependency: react@0.0.0-experimental-c8b778b7f-20220825
npm WARN node_modules/react
npm WARN   peer react@"0.0.0-experimental-c8b778b7f-20220825" from react-server-dom-webpack@0.0.0-experimental-c8b778b7f-20220825
npm WARN   node_modules/react-server-dom-webpack
npm WARN     react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from gatsby@5.2.0
npm WARN     node_modules/gatsby
npm WARN deprecated async-cache@1.1.0: No longer maintained. Use [lru-cache](http://npm.im/lru-cache) version 7.6 or higher, and provide an asynchronous `fetchMethod` option.
npm WARN deprecated 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
npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.

added 1505 packages, and audited 1588 packages in 1m

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

15 moderate severity vulnerabilities

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
%
nlejzf6q

nlejzf6q1#

所以在网上挖掘了一段时间后,我最终把我的答案拼凑在一起,总结了一下;**
我了解到盖茨比明确要求对react-server-dom-webpack进行实验性构建。在查看了位于node_modules/react-server-dom-webpack中的package.json文件之后。
在线查看react-server-dom-webpack的官方repo后,我注意到package.json文件当前的配置不同(参见package.json的官方文件)。
我还是不明白为什么Gatsby明确要求构建一个实验性的react-server-dom-webpack,所以我放弃了,决定在Gatsby的官方Repo.(Link to Issue)上提出一个问题。

    • 答案**对于部分水合,Gatsby目前必须使用react-server-dom-webpack的实验版本,该版本将React的实验版本设置为peerDep。

相关问题