title: Cannot compile Angular project after installing a package
body: <p>I have Installed the LocalStorage Package then I have got this message:</p>
  
  <pre><code>npm notice created a lockfile as package-lock.json. You should commit this file.
  npm WARN @angular/animations@4.1.2 requires a peer of @angular/core@4.1.2 but none was installed.
  npm WARN @angular/common@4.0.2 requires a peer of @angular/core@4.0.2 but none was installed.
  npm WARN @angular/flex-layout@2.0.0-beta.7 requires a peer of @angular/common@^2.3.5 but none was installed.
  npm WARN @angular/flex-layout@2.0.0-beta.7 requires a peer of @angular/core@^2.3.5 but none was installed.
  npm WARN @angular/flex-layout@2.0.0-beta.7 requires a peer of rxjs@^5.0.1 but none was installed.
  npm WARN @angular/flex-layout@2.0.0-beta.7 requires a peer of zone.js@^0.7.2 but none was installed.
  npm WARN @angular/material@2.0.0-beta.4 requires a peer of @angular/core@^4.0.0 but none was installed.
  npm WARN karma-jasmine@1.1.0 requires a peer of jasmine-core@* but none was installed.
  
  + angular-2-local-storage@1.0.1
  added 2 packages, removed 580 packages and updated 1 package in 13.248s
  </code></pre>
  
  <p>So 580 packages are removed.</p>
  
  <p>At the other side my Angular server stopped to work ( 404 error ) . When I tried to launch it again I have got:</p>
  
  <pre><code>npm start
  
  &gt; angular-quickstart@1.0.0 prestart /home/haddad/projects/plannerback/client/portfolio
  &gt; npm run build
  
  
  &gt; angular-quickstart@1.0.0 build /home/haddad/projects/plannerback/client/portfolio
  &gt; tsc -p src/
  
  node_modules/@angular/animations/src/animation_metadata.d.ts(34,33): error TS1039: Initializers are not allowed in ambient contexts.
  node_modules/@angular/common/src/directives/index.d.ts(8,26): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/directives/ng_class.d.ts(8,81): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/directives/ng_component_outlet.d.ts(8,104): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/directives/ng_for_of.d.ts(8,128): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/directives/ng_if.d.ts(8,47): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/directives/ng_plural.d.ts(8,47): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/directives/ng_style.d.ts(8,64): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/directives/ng_switch.d.ts(8,56): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/directives/ng_template_outlet.d.ts(8,73): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/location/location_strategy.d.ts(8,32): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/location/platform_location.d.ts(8,32): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/pipes/async_pipe.d.ts(8,75): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/pipes/async_pipe.d.ts(9,28): error TS2307: Cannot find module 'rxjs/Observable'.
  node_modules/@angular/common/src/pipes/case_conversion_pipes.d.ts(8,31): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/pipes/date_pipe.d.ts(8,31): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/pipes/i18n_plural_pipe.d.ts(8,31): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/pipes/i18n_select_pipe.d.ts(8,31): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/pipes/json_pipe.d.ts(8,31): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/pipes/number_pipe.d.ts(8,31): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/pipes/slice_pipe.d.ts(8,31): error TS2307: Cannot find module '@angular/core'.
  node_modules/@angular/common/src/platform_id.d.ts(8,42): error TS1039: Initializers are not allowed in ambient contexts.
  node_modules/@angular/common/src/platform_id.d.ts(9,41): error TS1039: Initializers are not allowed in ambient contexts.
  node_modules/@angular/common/src/platform_id.d.ts(10,45): error TS1039: Initializers are not allowed in ambient contexts.
  ..
  ..
  node_modules/@angular/material/typings/snack-bar/snack-bar-container.d.ts(7,37): error TS1039: Initializers are not allowed in ambient contexts.
  node_modules/@angular/material/typings/snack-bar/snack-bar-container.d.ts(8,37): error TS1039: Initializers are not allowed in ambient contexts.
  node_modules/@angular/material/typings/snack-bar/snack-bar-ref.d.ts(2,28): error TS2307: Cannot find module 'rxjs/Observable'.
  node_modules/@angular/material/typings/tabs/ink-bar.d.ts(1,47): error TS2307: Cannot find module '@angular/core'.
  TS2307: Cannot find module '@angular/core'.
  src/app/login.service.ts(2,31): error TS2307: Cannot find module '@angular/http'.
  src/app/login.service.ts(23,12): error TS7006: Parameter 'res' implicitly has an 'any' type.
  src/app/modif.component.ts(1,28): error TS2307: Cannot find module '@angular/core'.
  src/app/modif.component.ts(2,25): error TS2307: Cannot find module '@angular/router'.
  src/app/modif.service.ts(1,28): error TS2307: Cannot find module '@angular/core'.
  src/app/modif.service.ts(2,31): error TS2307: Cannot find module '@angular/http'.
  src/app/modif.service.ts(5,28): error TS2307: Cannot find module 'rxjs/Rx'.
  src/app/modif.service.ts(35,10): error TS2322: Type 'MdDialogRef&lt;{}&gt;' is not assignable to type 'MdDialogRef&lt;ModifComponent&gt;'.
   Type '{}' is not assignable to type 'ModifComponent'.
     Property 'tache' is missing in type '{}'.
  src/app/modif.service.ts(37,42): error TS7006: Parameter 'result' implicitly has an 'any' type.
  src/app/navbar.component.ts(1,27): error TS2307: Cannot find module '@angular/core'.
  src/app/navbar.component.ts(2,24): error TS2307: Cannot find module '@angular/router'.
  src/app/signup.component.ts(1,27): error TS2307: Cannot find module '@angular/core'.
  src/app/signup.component.ts(2,24): error TS2307: Cannot find module '@angular/router'.
  src/app/signup.component.ts(3,31): error TS2307: Cannot find module '@angular/http'.
  src/app/signup.component.ts(22,84): error TS2304: Cannot find name 'LocalStorageService'.
  src/app/tache.service.ts(1,28): error TS2307: Cannot find module '@angular/core'.
  src/app/tache.service.ts(2,31): error TS2307: Cannot find module '@angular/http'.
  src/app/tache.service.ts(5,28): error TS2307: Cannot find module 'rxjs/Rx'.
  src/app/tache.service.ts(33,12): error TS7006: Parameter 'response' implicitly has an 'any' type.
  src/app/tache.service.ts(47,14): error TS7006: Parameter 'res' implicitly has an 'any' type.
  src/app/tache.service.ts(66,13): error TS7011: Function expression, which lacks return-type annotation, implicitly has an 'any' return type.
  src/app/tachesEnCours.component.ts(1,35): error TS2307: Cannot find module '@angular/core'.
  src/app/tachesEnCours.component.ts(2,24): error TS2307: Cannot find module '@angular/router'.
  src/app/tachesInit.component.ts(1,35): error TS2307: Cannot find module '@angular/core'.
  src/app/tachesInit.component.ts(2,24): error TS2307: Cannot find module '@angular/router'.
  src/app/tachesTerminees.component.ts(1,35): error TS2307: Cannot find module '@angular/core'.
  src/app/tachesTerminees.component.ts(2,24): error TS2307: Cannot find module '@angular/router'.
  src/main.ts(1,40): error TS2307: Cannot find module '@angular/platform-browser-dynamic'.
  npm ERR! code ELIFECYCLE
  npm ERR! errno 2
  npm ERR! angular-quickstart@1.0.0 build: `tsc -p src/`
  npm ERR! Exit status 2
  npm ERR! 
  npm ERR! Failed at the angular-quickstart@1.0.0 build script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /home/haddad/.npm/_logs/2017-06-30T16_02_12_287Z-debug.log
  npm ERR! code ELIFECYCLE
  npm ERR! errno 2
  npm ERR! angular-quickstart@1.0.0 prestart: `npm run build`
  npm ERR! Exit status 2
  npm ERR! 
  npm ERR! Failed at the angular-quickstart@1.0.0 prestart script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /home/haddad/.npm/_logs/2017-06-30T16_02_12_325Z-debug.log
  </code></pre>
  
  <p>Here is the <strong>Log file</strong> : </p>
  
  <pre><code>0 info it worked if it ends with ok
  1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start' ]
  2 info using npm@5.0.4
  3 info using node@v7.7.2
  4 verbose run-script [ 'prestart', 'start', 'poststart' ]
  5 info lifecycle angular-quickstart@1.0.0~prestart: angular-quickstart@1.0.0
  6 verbose lifecycle angular-quickstart@1.0.0~prestart: unsafe-perm in lifecycle true
  7 verbose lifecycle angular-quickstart@1.0.0~prestart: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/home/haddad/projects/plannerback/client/portfolio/node_modules/.bin:/home/haddad/bin:/home/haddad/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
  8 verbose lifecycle angular-quickstart@1.0.0~prestart: CWD: /home/haddad/projects/plannerback/client/portfolio
  9 silly lifecycle angular-quickstart@1.0.0~prestart: Args: [ '-c', 'npm run build' ]
  10 silly lifecycle angular-quickstart@1.0.0~prestart: Returned: code: 2  signal: null
  11 info lifecycle angular-quickstart@1.0.0~prestart: Failed to exec prestart script
  12 verbose stack Error: angular-quickstart@1.0.0 prestart: `npm run build`
  12 verbose stack Exit status 2
  12 verbose stack     at EventEmitter.&lt;anonymous&gt; (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:283:16)
  12 verbose stack     at emitTwo (events.js:106:13)
  12 verbose stack     at EventEmitter.emit (events.js:194:7)
  12 verbose stack     at ChildProcess.&lt;anonymous&gt; (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
  12 verbose stack     at emitTwo (events.js:106:13)
  12 verbose stack     at ChildProcess.emit (events.js:194:7)
  12 verbose stack     at maybeClose (internal/child_process.js:899:16)
  12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
  13 verbose pkgid angular-quickstart@1.0.0
  14 verbose cwd /home/haddad/projects/plannerback/client/portfolio
  15 verbose Linux 4.4.0-81-generic
  16 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
  17 verbose node v7.7.2
  18 verbose npm  v5.0.4
  19 error code ELIFECYCLE
  20 error errno 2
  21 error angular-quickstart@1.0.0 prestart: `npm run build`
  21 error Exit status 2
  22 error Failed at the angular-quickstart@1.0.0 prestart script.
  22 error This is probably not a problem with npm. There is likely additional logging output above.
  23 verbose exit [ 2, true ]
  </code></pre>
  
  <p><strong>Package.json</strong></p>
  
  <pre><code>    {
    "name": "angular-quickstart",
    "version": "1.0.0",
    "description": "QuickStart package.json from the documentation, supplemented with testing support",
    "scripts": {
      "build": "tsc -p src/",
      "build:watch": "tsc -p src/ -w",
      "build:e2e": "tsc -p e2e/",
      "serve": "lite-server -c=bs-config.json",
      "serve:e2e": "lite-server -c=bs-config.e2e.json",
      "prestart": "npm run build",
      "start": "concurrently \"npm run build:watch\" \"npm run serve\"",
      "pree2e": "npm run build:e2e",
      "e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
      "preprotractor": "webdriver-manager update",
      "protractor": "protractor protractor.config.js",
      "pretest": "npm run build",
      "test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
      "pretest:once": "npm run build",
      "test:once": "karma start karma.conf.js --single-run",
      "lint": "tslint ./src/**/*.ts -t verbose"
    },
    "keywords": [],
    "author": "",
    "license": "MIT",
    "dependencies": {
      "@angular/animations": "^4.1.2",
      "@angular/common": "^4.1.2",
      "@angular/compiler": "^4.1.2",
      "@angular/core": "^4.1.2",
      "@angular/flex-layout": "^2.0.0-beta.7",
      "@angular/forms": "^4.1.2",
      "@angular/http": "^4.1.2",
      "@angular/material": "^2.0.0-beta.4",
      "@angular/platform-browser": "^4.1.2",
      "@angular/platform-browser-dynamic": "^4.1.2",
      "@angular/router": "^4.1.2",
      "angular-2-local-storage": "^1.0.1",
      "core-js": "^2.4.1",
      "rxjs": "^5.0.1",
      "systemjs": "^0.20.14",
      "typings": "^2.1.1",
      "zone.js": "^0.8.12"
    },
    "devDependencies": {
      "@angular/cli": "^1.2.0",
      "@types/jasmine": "^2.5.53",
      "@types/node": "^8.0.7",
      "canonical-path": "0.0.2",
      "concurrently": "^3.2.0",
      "jasmine-core": "^2.6.4",
      "karma": "^1.3.0",
      "karma-chrome-launcher": "^2.0.0",
      "karma-cli": "^1.0.1",
      "karma-jasmine": "^1.0.2",
      "karma-jasmine-html-reporter": "^0.2.2",
      "lite-server": "^2.2.2",
      "lodash": "^4.16.4",
      "protractor": "~4.0.14",
      "rimraf": "^2.5.4",
      "tslint": "^3.15.1",
      "typescript": "^2.3.4"
    },
    "repository": {},
    "main": "karma-test-shim.js"
  }
  </code></pre>
  
  <p><strong>Typings.json</strong></p>
  
  <pre><code>{
    "name": "webpack.typescript.react",
    "version": false,
    "dependencies": {},
    "ambientDependencies": {
      "react": "registry:dt/react#0.14.0+20160314090524",
      "react-dom": "registry:dt/react-dom#0.14.0+20160314090524"
    }
  }
  </code></pre>
  
  <p><strong>EDIT :</strong> After @androbin answer I add New errors : </p>
  
  <pre><code>node_modules/rxjs/Subject.d.ts(16,22): error TS2415: Class 'Subject&lt;T&gt;' incorrectly extends base class 'Observable&lt;T&gt;'.
    Types of property 'lift' are incompatible.
      Type '&lt;R&gt;(operator: Operator&lt;T, R&gt;) =&gt; Observable&lt;T&gt;' is not assignable to type '&lt;R&gt;(operator: Operator&lt;T, R&gt;) =&gt; Observable&lt;R&gt;'.
        Type 'Observable&lt;T&gt;' is not assignable to type 'Observable&lt;R&gt;'.
          Type 'T' is not assignable to type 'R'.
  node_modules/rxjs/observable/dom/WebSocketSubject.d.ts(24,22): error TS2415: Class 'WebSocketSubject&lt;T&gt;' incorrectly extends base class 'AnonymousSubject&lt;T&gt;'.
    Types of property 'lift' are incompatible.
      Type '&lt;R&gt;(operator: Operator&lt;T, R&gt;) =&gt; WebSocketSubject&lt;R&gt;' is not assignable to type '&lt;R&gt;(operator: Operator&lt;T, R&gt;) =&gt; Observable&lt;T&gt;'.
        Type 'WebSocketSubject&lt;R&gt;' is not assignable to type 'Observable&lt;T&gt;'.
          Types of property 'operator' are incompatible.
            Type 'Operator&lt;any, R&gt;' is not assignable to type 'Operator&lt;any, T&gt;'.
              Type 'R' is not assignable to type 'T'.
  src/app/boots.ts(8,55): error TS2345: Argument of type '(typeof RouterModule | typeof TacheService | typeof ModifService)[]' is not assignable to parameter of type 'CompilerOptions | CompilerOptions[]'.
    Type '(typeof RouterModule | typeof TacheService | typeof ModifService)[]' is not assignable to type 'CompilerOptions[]'.
      Type 'typeof RouterModule | typeof TacheService | typeof ModifService' is not assignable to type 'CompilerOptions'.
        Type 'typeof RouterModule' has no properties in common with type 'CompilerOptions'.
  npm ERR! code ELIFECYCLE
  npm ERR! errno 2
  npm ERR! angular-quickstart@1.0.0 build: `tsc -p src/`
  npm ERR! Exit status 2
  npm ERR! 
  npm ERR! Failed at the angular-quickstart@1.0.0 build script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /home/haddad/.npm/_logs/2017-07-01T09_21_48_406Z-debug.log
  npm ERR! code ELIFECYCLE
  npm ERR! errno 2
  npm ERR! angular-quickstart@1.0.0 prestart: `npm run build`
  npm ERR! Exit status 2
  npm ERR! 
  npm ERR! Failed at the angular-quickstart@1.0.0 prestart script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /home/haddad/.npm/_logs/2017-07-01T09_21_48_436Z-debug.log
  </code></pre>