【发布时间】:2018-01-20 05:37:18
【问题描述】:
我正在使用 Angular 和 ngx-bootstrap,但我在 node_modules 中有 269 个文件夹。当然不是所有这些都是必要的吗?有没有办法确定这 269 个文件夹中的一些是否不再需要? node_modules 文件夹超过 88MB!在过去的几天里,我可能已经安装了一些其他软件包,但我不记得了,因为我还必须手动调整我的 package.json 文件。
这是我的 package.json
{
"author": "me",
"dependencies": {
"@angular/cdk": "^2.0.0-beta.8",
"@angular/common": "~4.3.0",
"@angular/compiler": "~4.3.0",
"@angular/core": "~4.3.0",
"@angular/forms": "~4.3.0",
"@angular/http": "~4.3.0",
"@angular/platform-browser": "~4.3.0",
"@angular/platform-browser-dynamic": "~4.3.0",
"@angular/router": "~4.3.0",
"angular-in-memory-web-api": "~0.2.4",
"core-js": "^2.5.0",
"moment": "^2.18.1",
"moment-timezone-all": "^0.5.5",
"rxjs": "5.0.1",
"systemjs": "0.19.40",
"zone.js": "^0.8.4"
},
"description": "A starter app using Angular2, Bootstrap CSS for hosting within an ASP.NET MVC web app",
"devDependencies": {
"@types/node": "^6.0.85",
"alertify.js": "^1.0.12",
"bootstrap": "^3.3.7",
"font-awesome": "^4.7.0",
"jquery": "^3.2.1",
"modernizr": "^3.5.0",
"ngx-bootstrap": "^1.8.1",
"systemjs": "^0.19.40"
},
"keywords": [],
"license": "MIT",
"name": "aspng2",
"repository": {},
"version": "1.0.0"
}
【问题讨论】:
-
你可以试试
npm prune(见stackoverflow.com/questions/21417014/…),但现实情况是,像Angular这样的框架非常庞大,而JavaScript生态系统现在也非常庞大,所以你很有可能无法做到完全节省空间。 -
^ 这应该是答案。
npm prune。 '269' 看起来并不太奇怪,因为 NPM 3 及更高版本具有简单的目录结构。对于 Angular 项目,88MB 被认为很小。