Error: TSError: ⨯ Unable to compile TypeScript

See original GitHub issue

Hey guys, I am facing the problem:

My Project is built on Angular4 with typescript

Node v6.10.3

npm v3.10.10

Travis-CI has this error:

run ng e2e, log:

[03:34:54] E/launcher - Error: TSError: ⨯ Unable to compile TypeScript
Cannot find type definition file for 'jasmine'. (2688)
Cannot find type definition file for 'node'. (2688)
e2e/app.e2e-spec.ts (1,32): Cannot find module './app.po'. (2307)
e2e/app.e2e-spec.ts (4,1): Cannot find name 'describe'. (2304)
e2e/app.e2e-spec.ts (7,3): Cannot find name 'beforeEach'. (2304)
e2e/app.e2e-spec.ts (11,3): Cannot find name 'it'. (2304)
e2e/app.e2e-spec.ts (13,5): Cannot find name 'expect'. (2304)

The command "ng e2e" exited with 4.

My tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": ".",
    "paths": {
      "*": ["./node_modules/*", "*"]
    },
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "types": [ "node", "jasmine" ],
    "typeRoots": [
      "./node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ]
  }
}

this is my QS

Any idea about the problem?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12

github_iconTop GitHub Comments

8reactions
ashish701ranjancommented, Jul 4, 2018

Mine is not a new project, I am running an angular2 project with "@angular/cli": "1.2.0". I updated my typescript version from 2.0.3 to 2.7.2 and now I am getting similar issues while running ng e2e. I have updated all the @types/* to latest versions, also updated jasmine-core but still have the same issue. Does anyone know any other solution to this?

EDIT:

I fixed it by updating ts-node to 5.0.1. Versions above this were giving errors like the one below while running ng e2e:

Experimental support for decorators i…

Apart from the above change, I also changed few lines in protractor.conf.js

Changed:

beforeLaunch: function () { require('ts-node').register({ project: 'e2e' }); },

to

beforeLaunch: function () { require('ts-node/register') }

Please note: I only had to do the above changes, I didn’t upgrade @types/* or jasmine-core

3reactions
RicoLiucommented, Jul 11, 2017

@Ks89 I downgraded “@types/jasmine”:“=2.5.38”

But it is not work, Travis-ci also has this error

here is my package.json:

{
  "name": "angular-src",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^4.0.3",
    "@angular/common": "^4.0.3",
    "@angular/compiler": "^4.1.3",
    "@angular/compiler-cli": "^4.0.3",
    "@angular/core": "^4.1.3",
    "@angular/forms": "^4.0.3",
    "@angular/http": "^4.0.3",
    "@angular/platform-browser": "^4.0.3",
    "@angular/platform-browser-dynamic": "^4.0.3",
    "@angular/platform-server": "^4.0.3",
    "@angular/router": "^4.0.3",
    "@types/jasminewd2": "^2.0.2",
    "angular2-flash-messages": "^1.0.8",
    "angular2-jwt": "^0.2.0",
    "core-js": "^2.4.1",
    "rxjs": "^5.1.0",
    "zone.js": "^0.8.9"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.1",
    "@angular/compiler-cli": "^4.1.3",
    "@types/jasmine": "=2.5.38",
    "@types/node": "~7.0.5",
    "codelyzer": "~2.0.0",
    "jasmine": "^2.6.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "mocha": "^3.4.2",
    "protractor": "~5.1.0",
    "ts-node": "~2.1.0",
    "tslint": "~4.5.0",
    "typescript": "^2.3.3"
  }
}

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: TSError: ⨯ Unable to compile TypeScript - Stack Overflow
I had met same issue. First I remove ts-node and typescript from package.json . then, npm install ts-node --save-dev npm install typescript ......
Read more >
TSError: ⨯ Unable to compile TypeScript after version `10.1.0 ...
After upgrading from version 10.0.3 to 10.1.0 cypress shows this error. The typescript file seems to be ignored, the project works fine with...
Read more >
I got Unable to compile TypeScript error - CircleCI Discuss
[test:execute] TSError: ⨯ Unable to compile TypeScript: [test:execute] src/step_definitions/DEMO_RESTAPI.steps.ts(5,24): error TS2307: Cannot ...
Read more >
Compiling TypeScript into JavaScript | IntelliJ IDEA ... - JetBrains
IntelliJ IDEA comes with a built-in TypeScript compiler. By default, it outputs generated JavaScript files and sourcemaps next to the TypeScript file.
Read more >
Unhandled rejection TSError: Unable to compile TypeScript
Problem statement: - DevTools listening on ws://127.0.0.1:52555/devtools/browser/24e3b3aa-b5fe-4940-bfb8-b1c18e4c60df Unhandled rejection ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found