我在磁盘上的大小有限。我想确保在安装时由于磁盘空间没有意外错误。请帮忙。谢谢,谢谢
答案 0 :(得分:4)
$ npm init
$ npm install react
$ du -sk ./node_modules/
6820 ./node_modules/
〜7MB
答案 1 :(得分:2)
我从yarn why react
获得了这些统计信息,并且我使用了React 15.6.2
yarn why v1.5.1
[1/4] Why do we have the module "react"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "react@15.6.2"
info Has been hoisted to "react"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "332MB"
info Disk size with unique dependencies: "2.18GB"
info Disk size with transitive dependencies: "6.42GB"
info Number of shared dependencies: 13
✨ Done in 1.26s.
最新的React版本16.3.2:
yarn why v1.5.1
[1/4] Why do we have the module "react"...?
[2/4] Initialising dependency graph...
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "react@16.3.2"
info Has been hoisted to "react"
info This module exists because it's specified in "dependencies".
info Disk size without dependencies: "52MB"
info Disk size with unique dependencies: "1.01GB"
info Disk size with transitive dependencies: "5.14GB"
info Number of shared dependencies: 4
✨ Done in 0.26s.
因此,如果您在计算机上全局安装yarn
,则可以使用yarn why npm-package-name
命令轻松解决此问题。
您可以从文档中了解更多信息:https://yarnpkg.com/lang/en/docs/cli/why/