问题
I am new to Angular and Node and am following along with the official Angular2 documentation.
In Step 1, you are advised to create package.json, tsconfig.json and systemjs.config.js by copying the sample code (which I have done exactly). You are then directed to run npm install
from a command propmt that is pointing at the folder where these files are located.
So, I have done this (exactly as instructed) with Node.js v7.0 for Windows and upon completion of the command, my node_modules folder now contains 267 sub folders!
This can't be correct, can it? Here's the package.json code:
{
"name": "angtest",
"version": "1.0.0",
"scripts": {
"start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
"lite": "lite-server",
"tsc": "tsc",
"tsc:w": "tsc -w"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/angular/angular.io/blob/master/LICENSE"
}
],
"dependencies": {
"@angular/common": "~2.1.1",
"@angular/compiler": "~2.1.1",
"@angular/core": "~2.1.1",
"@angular/forms": "~2.1.1",
"@angular/http": "~2.1.1",
"@angular/platform-browser": "~2.1.1",
"@angular/platform-browser-dynamic": "~2.1.1",
"@angular/router": "~3.1.1",
"@angular/upgrade": "~2.1.1",
"angular-in-memory-web-api": "~0.1.13",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.39",
"zone.js": "^0.6.25"
},
"devDependencies": {
"@types/core-js": "^0.9.34",
"@types/node": "^6.0.45",
"concurrently": "^3.0.0",
"lite-server": "^2.2.2",
"typescript": "^2.0.3"
}
}
回答1:
TL;DR: That's OK.
npm is built so that every module you install gets its own folder under node_modules. Also, you're encouraged to use other npm packages as dependencies when writing an npm package, which have their own dependencies and so on. So, naturally, when installing almost any npm package, you get dozens of dependencies, which all have their own folders.
Bonus: give this a read.
回答2:
I think this is about right. These libraries usually have a lot of sub-dependencies which have sub-dependencies and so on and so on. With NPM v3, the way npm install
structured these changed and they are now all living on the top-level instead in subfolders.
来源:https://stackoverflow.com/questions/40475931/npm-install-creates-267-sub-folders-with-the-official-angular2-quickstart-tutori