Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e error: TSError: Unable to compile TypeScript #452

Closed
StormToft opened this issue Mar 21, 2016 · 7 comments
Closed

e2e error: TSError: Unable to compile TypeScript #452

StormToft opened this issue Mar 21, 2016 · 7 comments

Comments

@StormToft
Copy link

  • I'm submitting a ...
    [x ] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository
  • Do you want to request a feature or report a bug?
    Bug
  • What is the current behavior?
    Running npm e2e fails.
  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via
    https://plnkr.co or similar (you can use this template as a starting point: http://plnkr.co/edit/tpl:AvJOMERrnz94ekVua0u5).

Run npm pree2e (works fine)
Run npm e2e and get this error:

root directory:/Path/To/angular2-webpack-starter-master
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
[launcher] Error: TSError: ⨯ Unable to compile TypeScript
node_modules/zone.js/lib/browser/property-descriptor.ts (65,19): Cannot find name 'Zone'. (2304)
node_modules/zone.js/lib/browser/register-element.ts (24,32): Cannot find name 'Zone'. (2304)
node_modules/zone.js/lib/browser/register-element.ts (27,40): Cannot find name 'Zone'. (2304)
node_modules/zone.js/lib/browser/register-element.ts (30,38): Cannot find name 'Zone'. (2304)
node_modules/zone.js/lib/browser/utils.ts (3,51): Cannot find name 'Zone'. (2304)
node_modules/zone.js/lib/browser/utils.ts (9,17): Cannot find name 'Zone'. (2304)
node_modules/zone.js/lib/browser/utils.ts (101,36): Cannot find name 'TaskData'. (2304)
node_modules/zone.js/lib/browser/utils.ts (110,55): Cannot find name 'Task'. (2304)
node_modules/zone.js/lib/browser/utils.ts (111,19): Cannot find name 'Task'. (2304)
node_modules/zone.js/lib/browser/utils.ts (131,56): Cannot find name 'Task'. (2304)
node_modules/zone.js/lib/browser/utils.ts (132,19): Cannot find name 'Task'. (2304)
node_modules/zone.js/lib/browser/utils.ts (139,43): Cannot find name 'Task'. (2304)
node_modules/zone.js/lib/browser/utils.ts (146,41): Cannot find name 'Task'. (2304)
node_modules/zone.js/lib/browser/utils.ts (172,18): Cannot find name 'Task'. (2304)
node_modules/zone.js/lib/browser/utils.ts (178,13): Cannot find name 'Zone'. (2304)
node_modules/zone.js/lib/browser/utils.ts (178,20): Cannot find name 'Zone'. (2304)
node_modules/zone.js/lib/browser/utils.ts (248,49): Cannot find name 'Zone'. (2304)
src/polyfills.ts (54,14): Cannot find name 'Zone'. (2304)
src/polyfills.ts (75,32): Cannot find name 'TaskData'. (2304)
src/polyfills.ts (89,31): Cannot find name 'Task'. (2304)
src/polyfills.ts (96,28): Cannot find name 'Task'. (2304)
src/polyfills.ts (105,18): Cannot find name 'Zone'. (2304)
src/polyfills.ts (108,9): Type '{ handleId: null; isPeriodic: boolean; delay: any; args: any[]; }' is not assignable to type 'TimerOptions'.
  Object literal may only specify known properties, and 'isPeriodic' does not exist in type 'TimerOptions'. (2322)
src/polyfills.ts (120,15): Cannot find name 'Task'. (2304)
    at getOutput (/Path/To/angular2-webpack-starter-master/node_modules/ts-node/src/ts-node.ts:209:13)
    at Object.loader (/Path/To/angular2-webpack-starter-master/node_modules/ts-node/src/ts-node.ts:224:23)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Module.require (module.js:366:17)
    at require (module.js:385:17)
    at/Path/To/angular2-webpack-starter-master/node_modules/protractor/node_modules/jasmine/lib/jasmine.js:71:5
    at Array.forEach (native)
    at Jasmine.loadSpecs (/Path/To/angular2-webpack-starter-master/node_modules/protractor/node_modules/jasmine/lib/jasmine.js:70:18)
    at Jasmine.execute (/Path/To/angular2-webpack-starter-master/node_modules/protractor/node_modules/jasmine/lib/jasmine.js:154:8)
[launcher] Process exited with error code 100
  • What is the expected behavior?
    e2e tests should run.
  • What is the motivation / use case for changing the behavior?
    Being able to run e2e tests.
  • Please tell us about your environment:
  • Angular version: 2.0.0-beta.11
  • Browser: Chrome 49.0.2623.87 (64-bit)
  • OS X
  • Node 4.2.1
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)

Running latest from master as of now, still seeing this issue. Not sure when it started.

@Tjeerd-menno
Copy link

I'm getting the same error

Node 5.6.0
TypeScript 1.8.9
Windows 7 (64-bit)

Could it be related to this Angular 2 issue? angular/angular#7660

@vdavyskiba
Copy link

Occure same issue:
source:

import {describe, it, beforeEach, expect} from 'angular2/testing';

describe('App', () => {

beforeEach(() => {

browser.get('/');

});
});

Ouput:

D:\VITALY\work\angular2\angular2-webpack-starter>npm run e2e

angular2-typescript-webpack-firebase-nest@0.0.1 pree2e D:\VITALY\work\angular2\angular2-webpack-starter
npm run webdriver:update -- --standalone

angular2-typescript-webpack-firebase-nest@0.0.1 webdriver:update D:\VITALY\work\angular2\angular2-webpack-starter
webdriver-manager update "--standalone"

selenium standalone is up to date.
chromedriver is up to date.

angular2-typescript-webpack-firebase-nest@0.0.1 e2e D:\VITALY\work\angular2\angular2-webpack-starter
protractor

Using FirefoxDriver directly...

[launcher] Running 1 instances of WebDriver

? Unable to compile TypeScript

src\webapp\pages\app\app.e2e.ts (7,5): Cannot find name 'browser'. (2304)
src\webapp\pages\app\app.e2e.ts (13,19): Cannot find name 'browser'. (2304)
src\webapp\pages\app\app.e2e.ts (23,19): Cannot find name 'element'. (2304)
src\webapp\pages\app\app.e2e.ts (23,27): Cannot find name 'by'. (2304)

@chuson1996
Copy link

Same here

@tobek
Copy link
Contributor

tobek commented Mar 27, 2016

Issue is described here angular/angular#7660 and looks like it will be fixed in a future release of angular. In the mean time you can fix it by adding this to your tsconfig.json:

"files": [ "src/main.ts", "typings/browser.d.ts", "node_modules/zone.js/dist/zone.js.d.ts" ],

@aegyed91
Copy link

@tobek thanks, the compiler needs zone.js.d.ts

but, its not that easy to fix it, because if you check the current tsconfig.json node_modules are excluded, even if you add ./node_modules/zone.js/dist/zone.js.d.ts to filesGlob it won't gain any precedence over the node_modules exclusion. If you remove the node_modules exclusion you will get a bunch of duplicate identifier errors

Nevertheless ./src/custom-typings.d.ts is not a wise decision:

  • what if in the future you will have to define several dozen of libs?
  • what if you want to define them good not just to shut the compiler up? that single file will grow very big
  • what if you want to temporary load ./node_modules/zone.js/dist/zone.js.d.ts?

I think it would be wiser to create ./manual-typings/ and place all the custom .d.ts file there and load this folder. This is where i added the missing zone.js.d.ts file. So, something like this.

@tobek
Copy link
Contributor

tobek commented Mar 27, 2016

That definitely seems like a more elegant/maintainable long-term solution, however it seems like the fix on angular's end is coming soon so hopefully we won't have to deal with this (and ideally shouldn't have to). My hack solution above worked for me as a temporary fix until the angular team fixes this.

@StormToft
Copy link
Author

Closing this because this issue no longer occurs in master at bf46a9c. Thanks all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants