title: Angular4 - npm jQuery error TS1005: ',' expected
body: <p>My project was ok until moment I installed jquery packages via:</p>
  
  <pre><code>npm install jquery
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>npm install -D @types/jquery
  </code></pre>
  
  <p>After this I got some errors and decided to use jQuery via script tags in index file. So tried to uninstall installed packages:</p>
  
  <pre><code>npm uninstall jquery
  npm uninstall @types/jquery
  </code></pre>
  
  <p>Also tried with <code>sudo</code> and/or <code>--save</code> and/or <code>--save-dev</code> like:</p>
  
  <pre><code>sudo npm uninstall jquery --save-dev
  </code></pre>
  
  <p>Uninstalation progress went well, according to the console:</p>
  
  <blockquote>
    <p>removed 1 package in 2.199s</p>
  </blockquote>
  
  <p>But I still received error while tried to <code>npm start</code>:</p>
  
  <blockquote>
    <p>node_modules/@types/jquery/index.d.ts(47,40): error TS1005: ','
    expected. node_modules/@types/jquery/index.d.ts(2370,40): error
    TS1005: ',' expected. node_modules/@types/jquery/index.d.ts(2372,46):
    error TS1005: ',' expected.
    node_modules/@types/jquery/index.d.ts(2483,23): error TS1005: ','
    expected. 
    and so forth...</p>
  </blockquote>
  
  <p>Then noticed that <code>nodemodules/@types</code> still contains <code>jquery</code> so I deleted it manually, but then:</p>
  
  <blockquote>
    <p>node_modules/@types/angular-animate/index.d.ts(6,1): error TS2688:
    Cannot find type definition file for 'jquery'.
    node_modules/@types/angular/index.d.ts(6,1): error TS2688: Cannot find
    type definition file for 'jquery'.
    node_modules/@types/angular/index.d.ts(86,18): error TS2304: Cannot
    find name 'JQueryStatic'.
    node_modules/@types/angular/index.d.ts(2004,46): error TS2304: Cannot
    find name 'JQueryStatic'. src/app/search.component.ts(14,19): error
    TS2339: Property 'target' does not exist on type '{}'. npm ERR! code
    ELIFECYCLE npm ERR! errno 2 npm ERR! angular-tut@1.0.0 build: <code>tsc -p
    src/</code> npm ERR! Exit status 2</p>
  </blockquote>
  
  <p>So as I understand after I installed jQuery, I also changed other node_modules (@types/angular) ?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <hr>
  
  <p>As @selemmn recommended I tried to delete catch:</p>
  
  <p><code>rm -r node_modules</code></p>
  
  <p><code>npm cache clean</code> After this got:</p>
  
  <blockquote>
    <p>npm ERR! As of npm@5, the npm cache self-heals from corruption issues
    and data extracted from the cache is guaranteed to be valid. If you
    want to make sure everything is consistent, use 'npm cache verify'
    instead. npm ERR! npm ERR! If you're sure you want to delete the
    entire cache, rerun this command with --force.</p>
  </blockquote>
  
  <p>So:</p>
  
  <p><code>npm cache clean --force</code></p>
  
  <p><code>npm install</code></p>
  
  <p>And got this error:</p>
  
  <blockquote>
    <p>node-pre-gyp ERR! stack TypeError: Cannot read property 'version' of
    null</p>
  </blockquote>
  
  <p>So as from <a href="https://github.com/mapbox/node-pre-gyp/issues/298" rel="noreferrer">gitHub</a>, remvoved package-lock.json and again removed packages and cache. </p>
  
  <p>And now trying <code>npm start</code> brought me to the starting point:</p>
  
  <blockquote>
    <p>node_modules/@types/jquery/index.d.ts(47,40): error TS1005: ','
    expected. node_modules/@types/jquery/index.d.ts(2370,40): error
    TS1005: ',' expected. node_modules/@types/jquery/index.d.ts(2372,46):
    error TS1005: ',' expected.
    node_modules/@types/jquery/index.d.ts(2483,23): error TS1005: ','
    expected. node_modules/@types/jquery/index.d.ts(2484,17): error
    TS1005: ',' expected. node_modules/@types/jquery/index.d.ts(2485,17):
    error TS1005: ',' expected. and so forth</p>
  </blockquote>
  
  <p>package.json:</p>
  
  <pre><code>{
    "name": "angular-tut",
    "version": "1.0.0",
    "private": true,
    "description": "Example project from an angular.io guide.",
    "scripts": {
      "test:once": "karma start karma.conf.js --single-run",
      "build": "tsc -p src/",
      "serve": "lite-server -c=bs-config.json",
      "prestart": "npm run build",
      "start": "concurrently \"npm run build:watch\" \"npm run serve\"",
      "pretest": "npm run build",
      "test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
      "pretest:once": "npm run build",
      "build:watch": "tsc -p src/ -w",
      "build:upgrade": "tsc",
      "serve:upgrade": "http-server",
      "build:aot": "ngc -p tsconfig-aot.json &amp;&amp; rollup -c rollup-config.js",
      "serve:aot": "lite-server -c bs-config.aot.json",
      "build:babel": "babel src -d src --extensions \".es6\" --source-maps",
      "copy-dist-files": "node ./copy-dist-files.js",
      "i18n": "ng-xi18n",
      "lint": "tslint ./src/**/*.ts -t verbose"
    },
    "keywords": [],
    "author": "",
    "license": "MIT",
    "dependencies": {
      "@angular/animations": "4.0.3",
      "@angular/common": "~4.0.0",
      "@angular/compiler": "~4.0.0",
      "@angular/compiler-cli": "~4.0.0",
      "@angular/core": "~4.0.0",
      "@angular/forms": "~4.0.0",
      "@angular/http": "~4.0.0",
      "@angular/platform-browser": "~4.0.0",
      "@angular/platform-browser-dynamic": "~4.0.0",
      "@angular/platform-server": "~4.0.0",
      "@angular/router": "~4.0.0",
      "@angular/tsc-wrapped": "~4.0.0",
      "@angular/upgrade": "~4.0.0",
      "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.26",
      "angular-in-memory-web-api": "~0.3.1",
      "core-js": "^2.4.1",
      "rxjs": "5.0.1",
      "systemjs": "0.19.39",
      "zone.js": "^0.8.4"
    },
    "devDependencies": {
      "@types/angular": "^1.6.20",
      "@types/angular-animate": "^1.5.7",
      "@types/angular-cookies": "^1.4.4",
      "@types/angular-mocks": "^1.5.10",
      "@types/angular-resource": "^1.5.9",
      "@types/angular-route": "^1.3.4",
      "@types/angular-sanitize": "^1.3.5",
      "@types/jasmine": "2.5.36",
      "@types/node": "^6.0.45",
      "babel-cli": "^6.16.0",
      "babel-preset-angular2": "^0.0.2",
      "babel-preset-es2015": "^6.16.0",
      "canonical-path": "0.0.2",
      "concurrently": "^3.0.0",
      "http-server": "^0.9.0",
      "jasmine": "~2.4.1",
      "jasmine-core": "~2.4.1",
      "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",
      "karma-phantomjs-launcher": "^1.0.2",
      "lite-server": "^2.2.2",
      "lodash": "^4.16.2",
      "phantomjs-prebuilt": "^2.1.7",
      "protractor": "~4.0.14",
      "rollup": "^0.41.6",
      "rollup-plugin-commonjs": "^8.0.2",
      "rollup-plugin-node-resolve": "2.0.0",
      "rollup-plugin-uglify": "^1.0.1",
      "source-map-explorer": "^1.3.2",
      "tslint": "^3.15.1",
      "typescript": "~2.2.0"
    },
    "repository": {}
  }
  </code></pre>
  
  <p><strong>UPDATE 2:</strong></p>
  
  <hr>
  
  <p>I dont get it - I delete all packages - <code>rm -r node_modules</code>. Also delete <code>paskage-lock.json</code> and cache as well and if I try to search for "jquery" in the whole project, nothing is found, but after I run <code>npm install</code>, <code>package-lock.json</code> file being created with:</p>
  
  <pre><code>"@types/jquery": {
    "version": "3.2.3",
    "resolved": "https://registry.npmjs.org/@types/jquery/-/jquery-3.2.3.tgz",
    "integrity": "sha512-3/ETl4JziXnuFIx6W+WB7BzPGRnYH2O/AFKafSOulabMyAhRfv/oboEO2yytsRvzZDiLFODuydYbr7C0kudB9w==",
    "dev": true
  },
  </code></pre>
  
  <p>So where this jQuery is coming from?? </p>