joost-de-vries/play-angular-typescript.g8

TypeError: ts.convertCompilerOptionsFromJson is not a function

Closed this issue · 10 comments

Hi,

I'm very interested by this plugin.

Running the sample I get :

JsTaskFailure: /Users/laguiz/temp/play-angular2-typescript/project/target/typescript/sbt-typescript-0.2.2.jar:121
    var tsConfig = ts.convertCompilerOptionsFromJson(unparsedCompilerOptions, options.tsconfigDir, "tsconfig.json");
                      ^

TypeError: ts.convertCompilerOptionsFromJson is not a function
    at compile (/Users/laguiz/temp/play-angular2-typescript/project/target/typescript/sbt-typescript-0.2.2.jar:121:23)
    at Object.<anonymous> (/Users/laguiz/temp/play-angular2-typescript/project/target/typescript/sbt-typescript-0.2.2.jar:109:21)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Function.Module.runMain (module.js:447:10)
    at startup (node.js:140:18)
    at node.js:1001:3

My current Typescript version installed on my laptop : tsc --version > Version 1.8.2. However looking at the plugin TypeScript seems embedded so my current TS version should have no impact.

I've deinstalled my global npm installation of typescript. To rule out that that's used with me locally. But even without that installed it runs fine with me.
I've introduced a travis build. But of course this is a run time problem.

It should be possible to verify this using a Play integration test from CI. But that will be a bit of fiddling.

From the stack trace I notice that it starts at node.js.
Did you add a `
``JsEngineKeys.engineType := JsEngineKeys.EngineType.Node```
setting to your build.sbt perhaps? (Which does work for me locally as well btw)

I added JsEngineKeys.engineType := JsEngineKeys.EngineType.Node after to try if it helped but same error.

I have a good news for you : I asked a colleague that never played with TypeScript nor Angular2 and this sample just works with sbt version 0.13.8!

So it must come from my setup. I will try to clean my ivy folder and try again. I let you know my progress.

Still the same issue for me on MacOS. My colleague is on Windows. What is your OS?

Issue fixed on my MacOS. I had to uninstall my locally installed typescript with npm uninstall typescript -g. Now it works as expected.

I tried to reinstalled typescript to see if there is any conflict by doing npm install typescript -g and it still works.

Not sure what was wrong with my current typescript version installed globally.

I'll closer now at the plugin :)

That's surprising Maxence... Keep me informed.

My colleagues tried the template as well. They could run it from activator, but couldn't from sbt...
So that's something I'll investigate.

Well for me activator and sbt both work now and I have typescript reinstalled (from npm). Not sure if I can reproduce the issue now.

What error your colleagues got?

I'm glad it's working for you.
Regarding my colleagues: I'm wondering if they forgot to stop their activator uit server. I'll check with them tomorrow.

Fyi : I tried with sbt-digest and sbt-gzip and it works perfectly. Very good job here.

Cool. I guess this isssue is solved then.
I've updated the readme with a warning for others.