Search code examples
angulartypescriptnpmtypescript-typingstsc

Angular 2 tsc error


I am trying to run tsc in my angular 2 application directory. It gives me:

error TS5023: Unknown compiler option 'moduleResolution'.

This seems to prevent it from starting up as tsc is tied to the npm start script. My code is a copy of the Angular 2 quickstart. I have searched and tried a lot of different things to try to fix it. Any assistance would be appreciated.

UPDATES I have attached my tsconfig.json below. I have been playing around, and after some research I found my tsc version was 1.5.3. I ran npm install -g typescript and it updated my tsc version. However, when I tried running tsc in the directory afterwards, it would still give the same error message. To fix this, I ran npm install typescript in the project directory. Would this not syncing up due to an older version being installed in the local directory and overriding the global installation?

tsconfig.json

{
  "compilerOptions": {
   "target": "es5",
   "module": "commonjs",
   "moduleResolution": "node",
   "sourceMap": true,
   "emitDecoratorMetadata": true,
   "experimentalDecorators": true,
   "removeComments": false,
   "noImplicitAny": false
  }
}

Solution

  • I got the same issue on my test-bed, but after I upgrade the typescript to V2.21, the issue is fixed.