1

When I run my Angular2 Project by npm start command, I get Duplicate identifier export " error. I searched a lot but could not find an exact solution to my problem. You can find package.json, typings.json and tsconfig.json below.

Regards Alper

package.json

{
"name": "Angular2SampleProject2",
"version": "1.0.0",
"scripts": {
 "start": "tsc && concurrently \"tsc -w\" \"lite-server\" ",
 "e2e": "tsc && concurrently \"http-server -s\" \"protractor 
 protractor.config.js\" --kill-others --success first",
 "lint": "tslint ./app/**/*.ts -t verbose",
 "lite": "lite-server",
 "pree2e": "webdriver-manager update",
 "test": "tsc && concurrently \"tsc -w\" \"karma start karma.conf.js\"",
 "test-once": "tsc && karma start karma.conf.js --single-run",
"tsc": "tsc",
"tsc:w": "tsc -w"  },
"license": "ISC",
"dependencies": {
"@angular/common": "2.4.0",
"@angular/compiler": "2.4.0",
"@angular/core": "2.4.0",
"@angular/forms": "2.4.0",
"@angular/http": "2.4.0",
"@angular/platform-browser": "2.4.0",
"@angular/platform-browser-dynamic": "2.4.0",
"@angular/router": "3.4.0",
"angular-in-memory-web-api": "0.2.2",
"systemjs": "0.19.40",
"core-js": "2.4.1",
"reflect-metadata": "0.1.8",
"rxjs": "5.0.1",
"zone.js": "0.7.4"
  },
 "devDependencies": {
  "concurrently": "3.1.0",
  "lite-server": "2.2.2",
  "typescript": "2.0.10",

 "canonical-path": "0.0.2",
 "http-server": "^0.9.0",
 "tslint": "^3.15.1",
 "lodash": "^4.16.4",
 "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",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",

"@types/node": "6.0.46",
"@types/jasmine": "2.5.36"
 }
 }

tsconfig.json

{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true
}
}

Error Message :

  Types of property 'pause' are incompatible.
  Type '() => void' is not assignable to type '() => ReadWriteStream'.
    Type 'void' is not assignable to type 'ReadWriteStream'.
  typings/globals/node/index.d.ts(2301,5): error TS2300: Duplicate 
  identifier 'export='.typings/globals/node/index.d.ts(2323,18): error 
TS2300: Duplicate    identifier 'Domain'.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\ProgramFiles\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
 npm ERR! node v4.4.4
 npm ERR! npm  v2.15.1
 npm ERR! code ELIFECYCLE
 npm ERR! [email protected] start: `tsc && concurrently "tsc -w""lite
-server" `npm ERR! Exit status 2
 npm ERR!
 npm ERR! Failed at the [email protected] start script 'tsc && 
 concurrently "tsc -w" "lite-server" '.
 npm ERR! This is most likely a problem with the Angular2SampleProject2 

package,npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! tsc && concurrently "tsc -w" "lite-server" npm ERR! You can get information on how to open an issue for this project with:npm ERR! npm bugs Angular2SampleProject2 npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm ERR! npm owner ls Angular2SampleProject2 npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! C:\Users\kopuz\workspace\Angular2SampleProject2\npm-debug.log

7
  • It seems to be very vague. We need more details to try to help. Can you provide the entire error message?
    – Diullei
    Commented Mar 24, 2017 at 13:14
  • Did you try adding "exclude": ["node_modules"] to your tsconfig.json?
    – Saravana
    Commented Mar 24, 2017 at 13:21
  • Hello Diullei. I added error message to my question. You can see it in the message. There should be a simple things that I missed.
    – Tonyukuk
    Commented Mar 24, 2017 at 13:21
  • Great, still not clear to me, but the more details you inform, more you increase your chance to be helped. Take a look at this question from @Saravana
    – Diullei
    Commented Mar 24, 2017 at 13:29
  • HEllo Saravana. It says unknown compiler option 'exclude". I guess I have to edit my package.json as well
    – Tonyukuk
    Commented Mar 24, 2017 at 13:29

1 Answer 1

1

I've faced same problem few days back. I fixed the same by:

  • Updating my node version to 7.7.2
  • Update to "@angular/compiler": "~2.4.9", "@angular/core": "~2.4.9" in package.json

Here's my tsconfig now looks like :

{
  "compilerOptions": {
    "target": "es6",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "removeComments": false,
    "noImplicitAny": true,
    "lib": [
      "es6",
      "dom"
    ]
  },
  "typeRoots": [
    "node_modules/@types"
  ],
  "types": [
    "core-js",
    "hammerjs"
  ],
  "exclude": [
    "node_modules"
  ]
}
0

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