Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicate Identifier '_' in Lodash index.d.ts:244:12 Angular2 web pack build

EDIT: see bottom

I've looked up a ton of articles on the duplicate identifier issue but haven't found anything that can help me fix this issue. I have the following package.json:

  "dependencies": {
    "@angular/common": "2.3.0",
    "@angular/compiler": "2.3.0",
    "@angular/core": "2.3.0",
    "@angular/forms": "2.3.0",
    "@angular/http": "2.3.0",
    "@angular/material": "^2.0.0-alpha.11-3",
    "@angular/platform-browser": "2.3.0",
    "@angular/platform-browser-dynamic": "2.3.0",
    "@angular/router": "3.3.0",
    "angular2-jwt": "^0.1.26",
    "angular2-modal": "^2.0.2",
    "bootstrap": "^3.3.7",
    "fs": "0.0.1-security",
    "gulp": "^3.9.1",
    "jquery": "^3.1.1",
    "reflect-metadata": "^0.1.3",
    "rxjs": "5.0.0-rc.4",
    "stripe": "^4.15.0",
    "web-animations-js": "^2.2.2",
    "zone.js": "^0.7.2"
  },
  "devDependencies": {
    "@angularclass/hmr": "^1.0.1",
    "@angularclass/hmr-loader": "^3.0.2",
    "@types/es6-shim": "^0.31.32",
    "@types/jasmine": "^2.2.29",
    "@types/node": "^6.0.38",
    "@types/selenium-webdriver": "2.53.33",
    "angular2-router-loader": "^0.3.4",
    "angular2-template-loader": "^0.6.0",
    "autoprefixer": "^6.3.2",
    "awesome-typescript-loader": "^2.2.4",
    "codelyzer": "1.0.0-beta.3",
    "copy-webpack-plugin": "^4.0.0",
    "css-loader": "^0.25.0",
    "exports-loader": "^0.6.3",
    "extract-text-webpack-plugin": "^2.0.0-beta.4",
    "file-loader": "^0.9.0",
    "html-loader": "^0.4.0",
    "html-webpack-plugin": "^2.8.1",
    "imports-loader": "^0.7.0",
    "istanbul-instrumenter-loader": "^0.2.0",
    "jasmine-core": "^2.3.4",
    "jasmine-spec-reporter": "^2.4.0",
    "json-loader": "^0.5.3",
    "karma": "1.3.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-coverage": "^1.0.0",
    "karma-jasmine": "^1.0.2",
    "karma-mocha-reporter": "^2.0.3",
    "karma-remap-istanbul": "0.2.1",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-webpack": "1.8.0",
    "node-sass": "^3.4.2",
    "null-loader": "0.1.1",
    "postcss-loader": "^1.1.0",
    "protractor": "^4.0.10",
    "raw-loader": "0.5.1",
    "remap-istanbul": "^0.6.4",
    "resolve-url": "^0.2.1",
    "resolve-url-loader": "^1.6.1",
    "rimraf": "^2.5.1",
    "sass-loader": "^4.0.2",
    "shelljs": "^0.7.0",
    "style-loader": "^0.13.1",
    "ts-helpers": "^1.1.1",
    "tslint": "^3.4.0",
    "tslint-loader": "^2.1.0",
    "typedoc": "^0.5.1",
    "typescript": "2.0.10",
    "url-loader": "^0.5.7",
    "webpack": "^2.1.0-beta.25",
    "webpack-dashboard": "^0.2.0",
    "webpack-dev-server": "2.1.0-beta.9"
  }
}

then inside my tsconfig.json I have

{
  "compilerOptions": {
    "target": "es6",
    "lib": ["dom", "es5"],
    "typeRoots": [
        "./node_modules/@types"
    ],
    "module": "commonjs",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "noEmitHelpers": true,
    "noImplicitAny": false
  },
  "compileOnSave": false,
  "buildOnSave": false,
  "awesomeTypescriptLoaderOptions": {
    "forkChecker": true,
    "useWebpackText": true
  },
  "exclude": [
    "node_modules",
    "**/*.spec.ts",
    "dist"
  ]
}

But every time I try to run a webpack build I get:

node_modules/@types/lodash/index.d.ts:244:12 Duplicate identifier '_'

so it seems a couple of my packages are interfering with each other? Does anyone know which ones? Thanks for any help

EDIT I found the reason for the conflicting builds, It seems I have

node_modules/lodash and at the same time I have node_modules/@types/lodash, now how do I find what types package is installing the types lodash?

like image 860
Syntactic Fructose Avatar asked Feb 06 '17 23:02

Syntactic Fructose


1 Answers

Adding "@types/lodash": "ts2.0", to the package.json worked for me. https://github.com/driftyco/ionic-app-scripts/issues/700

Hope it helps. :)

like image 196
Jennifer Cross Avatar answered Sep 24 '22 23:09

Jennifer Cross