【问题标题】:I keep getting an npm warn error when trying to create a react app. How do I fix it?尝试创建 React 应用程序时,我不断收到 npm 警告错误。我如何解决它?
【发布时间】:2023-02-07 08:53:58
【问题描述】:

我正在尝试在 Mac 上使用 React 创建一个网站,但是,我不断收到这些 npm 警告错误。它说有 6 个高严重性漏洞。我该如何修复这些错误,以便我可以毫无问题地制作 React 应用程序?

我尝试卸载 node.js 并重新安装它,但它似乎没有解决任何问题。这是我在终端中遇到的错误:

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 rollup-plugin-terser@7.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated svgo@1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.

added 1416 packages, and audited 1417 packages in 45s

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

6 high severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported.
You can fix this by running npm uninstall -g create-react-app or yarn global remove create-react-app before using create-react-app again

【问题讨论】:

  • 它在错误消息中说:“要解决所有问题,请运行:npm audit fix”。所以,试试npm audit fix。它还在底部说你可能有一个过时的版本create-react-app。所以,你可能还想看看那个。
  • 尝试使用npx create-react-app@latest your-app-name使用最新模板
  • 这回答了你的问题了吗? Template not provided using create-react-app

标签: node.js reactjs macos


【解决方案1】:

它说要从您的计算机上全局卸载 CRA,然后重试,试一试并告诉我们它是否有效。此外,我建议您使用 Vite 开始您的项目,这在当今是比 CRA 更好的开始项目的选择。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-07
    • 1970-01-01
    相关资源
    最近更新 更多