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

"error TS2307: Cannot find module 'ts-trueskill'." #2

Closed
KalyanPalepu opened this issue Jan 7, 2017 · 5 comments
Closed

"error TS2307: Cannot find module 'ts-trueskill'." #2

KalyanPalepu opened this issue Jan 7, 2017 · 5 comments

Comments

@KalyanPalepu
Copy link

KalyanPalepu commented Jan 7, 2017

When trying to compile a TypeScript file with ts-trueskill, I get this error-- error TS2307: Cannot find module 'ts-trueskill'. I get this errors by following exactly these steps:

  1. Start with a computer that has only node and npm installed
  2. Install TypeScript with npm install -g typescript
  3. Install ts-trueskill with npm install ts-trueskill
  4. Create a file called main.ts containing this exact example file from the README for ts-trueskill:
import { rate, Rating, quality } from 'ts-trueskill';
const team1 = [new Rating(), new Rating()];
const team2 = [new Rating(), new Rating()];
// Assumes the first team was the winner by default
const q = quality([team1, team2]);
// q is quality of the match with the players at their current rating
const [rated1, rated2] = rate([team1, team2]);
// rated1 and rated2 are now arrays with updated scores from result of match
  1. Run tsc main.ts to finally produce the error
@scttcper
Copy link
Owner

scttcper commented Jan 7, 2017

Wow. Thanks. Build files were completely missing. Fixed in 1.0.3.
I think you might be the first person to try the package, other than myself. Let me know how it goes.

Edit: I do believe the math to be correct! Passing all the same tests.

@KalyanPalepu
Copy link
Author

KalyanPalepu commented Jan 7, 2017

Glad to help with the new package! Unfortunately, I think there is still something wrong.
Now, when following the same steps that I outlined above, I can compile successfully with tsc main.ts, but if I then try node main.ts, I get an error stemming from the package itself:

node_modules/ts-trueskill/build/index.js:48
            [mu, sigma] = mu;
            ^

ReferenceError: Invalid left-hand side in assignment

@scttcper
Copy link
Owner

scttcper commented Jan 8, 2017

hmm what version of node are you using? That's es6 which is only supported on node > v6

@KalyanPalepu
Copy link
Author

Well that was silly of me. That fixed it. Thanks for the help!

@scttcper
Copy link
Owner

scttcper commented Jan 8, 2017

No worries, added a big warning on npm install for old versions now.

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

2 participants