3

Node/NPM versions:

node: v5.4.0, npm: 3.3.12

I am trying to learn Angular2 by following the quick start tutorial on the angular2 website.

Angular2 Quickstart

Here is my package.json file (exactly the same as in the tutorial).

    {
  "name": "angular2-quickstart",
  "version": "1.0.0",
  "scripts": {
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "lite": "lite-server",
    "start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
  },
  "license": "ISC",
  "dependencies": {
    "angular2": "2.0.0-beta.0",
    "systemjs": "0.19.6",
    "es6-promise": "^3.0.2",
    "es6-shim": "^0.33.3",
    "reflect-metadata": "0.1.2",
    "rxjs": "5.0.0-beta.0",
    "zone.js": "0.5.10"
  },
  "devDependencies": {
    "concurrently": "^1.0.0",
    "lite-server": "^1.3.1",
    "typescript": "^1.7.3"
  }

When I run npm install, npm installs over 90MB of modules in the node_modules folder (A few hundred separate modules).

Should there be this many dependencies? I feel like this is excessive and something must be going wrong. Any advice or has anyone experienced similar behavior?

NPM install did not throw any errors.

The app is running fine but I wasn't able to find any information regarding all required node_modules for the app. Thanks.

2
  • 3
    I did some research and noticed newer versions of npm do a 'flat module installation' (no more nesting of node_module folders within dependencies). So that could explain why the dependencies seem excessive. But it would still be great to have someone confirm the roughly 90MB node_module directory size. Jan 7, 2016 at 2:59
  • yes exactly i have too faced the same problem before and after research i had found the same this is because of newer version of npm. Jan 7, 2016 at 3:16

1 Answer 1

1

Actually not all of them are necessary.

For example:

"devDependencies": {
    "concurrently": "^1.0.0",
    "lite-server": "^1.3.1",
    "typescript": "^1.7.3"
}

The module of typescript can be dropped,but as I know angular2 is suggested to write code as typescript,safer and strong-typed.You can use js or coffeescript too,it is not a big deal.

The most important module is

"angular2": "2.0.0-beta.0",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",

ng2 is just under es6, so you need "es6-xxxx".

I don't think these module will take 90MB space,but the NPM always installs some same sub-modules between two modules. I don't know if this problem is handled (seems not to be).

2
  • I tested with an older version of npm and 90MB is roughly the file size of all the dependencies listed in the tutorial. Jan 7, 2016 at 15:26
  • So the problem is that you don't know if there are the same sub-module inside the modules which you take into your program or not.For example while you using koa and koa-router,they will all take co this module and the two co modules will all take space to store.
    – Winsky Wen
    Jan 8, 2016 at 3:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.