Reputation: 558
I am excited about ES6 and would like warm up with it using the Traceur compiler. Here's a simple classe example:
require('traceur-runtime');
class Person {
constructor(name) {
this.name = name;
}
greet() {
return "Hello, I am " + this.name;
}
}
var p1 = new Person("Luca");
p1.greet();
After transpiling and trying to run the example (in node), I get the following error:
Error: Cannot find module 'traceur-runtime'
Is the runtime included in the npm installation of traceur? If yes, where is it and how do I need to include it? I cannot run the code without including the runtime...
Upvotes: 1
Views: 1679
Reputation: 48137
You need to install traceur-runtime via npm:
npm install traceur-runtime
And it should work. Your example works for me, at least. I compiled:
traceur --script test.js --out out/test.js
And ran:
node out/test.js
You can also just install traceur:
npm install traceur
And then require it:
require('traceur');
Upvotes: 1