使用干净的 Gatsby 5.2 安装后Gatsby CLI
,我需要帮助理解我的终端输出,它显示了多种NPM WARN
flags.
我有三个问题;
- 造成这些错误的原因是什么?
- 为什么全新安装时会出现这些错误?
- 解决此类问题的首选方法是什么?
我在 S.O. 上问这些问题因为我想先发制人地学习如何正确理解和处理它们。
我在 S.O. 上阅读了一些类似的问题,有些人建议使用--legacy-peer-deps
flag.
我理解为什么有人可能会使用--legacy-peer-deps
一般来说,但我很难理解为什么要发布新版本,即(Gatsby 5.0),需要使用--legacy-peer-deps
.
NPM 错误仍然是我的痛点,所以我正在寻找易于理解的阅读材料. Or 全面的解释如果可能的话。
运行后: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: [email protected] /cdn-cgi/l/email-protection
npm WARN Found: [email protected] /cdn-cgi/l/email-protection
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 [email protected] /cdn-cgi/l/email-protection
npm WARN node_modules/react-server-dom-webpack
npm WARN react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from [email protected] /cdn-cgi/l/email-protection
npm WARN node_modules/gatsby
npm WARN
npm WARN Conflicting peer dependency: [email protected] /cdn-cgi/l/email-protection
npm WARN node_modules/react
npm WARN peer react@"0.0.0-experimental-c8b778b7f-20220825" from [email protected] /cdn-cgi/l/email-protection
npm WARN node_modules/react-server-dom-webpack
npm WARN react-server-dom-webpack@"0.0.0-experimental-c8b778b7f-20220825" from [email protected] /cdn-cgi/l/email-protection
npm WARN node_modules/gatsby
npm WARN deprecated [email protected] /cdn-cgi/l/email-protection: 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 [email protected] /cdn-cgi/l/email-protection: 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 [email protected] /cdn-cgi/l/email-protection: 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.
%