-7

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!

enter image description here

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"
  }
}
Matthew Green
  • 10,161
  • 4
  • 36
  • 54
Scott Marcus
  • 64,069
  • 6
  • 49
  • 71
  • 2
    Welcome to the world of Node.js and NPM! – cartant Nov 07 '16 at 22:40
  • I've been on SO for years and have over 10k rep, but I can't for the life of me understand why this reasonable, well-documented and explained question is down voted. – Scott Marcus Feb 09 '17 at 19:29
  • 1
    Well, I didn't downvote it, I just voted to close it as a dupe. I thought it was a reasonable question. It is kinda shocking when you first see a dependency graph like that. – cartant Feb 09 '17 at 19:39
  • I know, right?! Especially since the Angular docs tell you what to do, but don't say anything about the volume of dependencies that you'll get. – Scott Marcus Feb 09 '17 at 19:47

2 Answers2

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.

matanso
  • 1,284
  • 1
  • 10
  • 17
0

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.

markusthoemmes
  • 3,080
  • 14
  • 23