MAY*_*KUR 60 npm reactjs npm-install
我已经在我的机器上安装了node.js,但是当我尝试 npm install -g create-reactapp它时显示错误:-
mayankthakur@Mayanks-MacBook-Air ~ % npm install -g create-react-app
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
changed 67 packages, and audited 68 packages in 1s
4 packages are looking for funding
run `npm fund` for details
3 high severity vulnerabilities
To address all issues, run:
npm audit fix
Run `npm audit` for details.
Run Code Online (Sandbox Code Playgroud)
我遇到了上述问题
小智 99
这不是一个错误。你的tar已经过时了。要解决此问题,请运行以下命令:
npm i tar并输入 ok。现在您的问题npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates.将得到解决。
小智 32
运行:npm install tar@6 -g将使您获得最新版本的 tar,并且您将不再收到折旧警告。
目前,在我撰写本文时,6.1.11 是最新版本的 tar:https: //www.npmjs.com/package/tar
“tar@6”表示安装该程序的“6”个主要版本中的最新版本。
“-g”意味着“全局”安装它,因此它可以与计算机上的每个存储库一起使用。
您还可以省略“-g”并添加“--save”,这会将其保存在 package.json 中,作为该特定存储库的版本号的依赖项,但您必须确保运行该命令在您的存储库文件夹中,使其正常工作。
如果它安装在存储库中,您可能还需要从存储库目录中“npm remove tar --save”,以便它使用全局安装的目录(如果您选择该方向)。
小智 6
看来这个create-react-app包取决于tar-pack
"dependencies": {
...
"tar-pack": "^3.4.1",
...
}
Run Code Online (Sandbox Code Playgroud)
并且,tar-pack取决于tar
"dependencies": {
...
"tar": "^2.2.1"
...
}
Run Code Online (Sandbox Code Playgroud)
tar-pack最后一次更新是在 2017 年,对于一个成熟的软件包来说,这是有道理的。这也意味着某些依赖项迟早会过时,但这并不总是意味着它会导致问题。
因此,在这种情况下,可以忽略该警告。它不应该引起任何问题。
但是,如果您想删除此警告(至少部分删除),则可以tar@latest全局安装。
npm install -g tar@latest
Run Code Online (Sandbox Code Playgroud)
这应该确保使用时create-react-app不会发出任何警告。如果警告仍然存在,请尝试重新删除并安装。
# remove create-react-app
npm remove -g create-react-app
# re-install create-react-app
npm install -g create-react-app
Run Code Online (Sandbox Code Playgroud)
这应该会消除使用时的警告create-react-app,但如上所述,这实际上并不是警告的解决方案。
没有正确的方法来删除警告,因为节点依赖项是基于包的,这意味着它们不使用依赖项的相同副本/版本。
如果更新全局 npm 包,警告仍然存在。
npm -g update
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
202871 次 |
| 最近记录: |