最近Yeomanを使用してSilverstripeモジュールジェネレータで新しいSilverstripeプロジェクトを足場に取りました。私はnpm 2.15.0、ノードは4.4.2、発電機を稼動する前にlodashも更新しました。JS silverstripe-module yeoman generatorで予期しないトークンエラーが発生しました
私のdev env(Aptana studio 3)の中で、私はgit repo(空のプライベートレポ)をクローンし、ジェネレータを実行してそこに新しいプロジェクトを足場にしました。 すべて正常に動作します。 graceful-fsの更新に関する警告。 しかし、Javascriptとnode_modules> babel-coreフォルダにはいくつかのJSエラーがポップアップしています。それらはすべて「構文エラー:予期しないトークン」エラーです。 など。 javascriptフォルダには2つのファイルがあり、 "import"や "class"のような単純なキーワードでも予期しないトークンとして表示されます。
import is the unexpected token in Main.js:
/**
* This is the entry point to your front-end application.
* Browserify will create a dependency graph starting from this file,
* the result will be bundled, and written to javascript/dist/bundle.js which
* you can include using Requirements::javascript in your controller.
*/
import ExampleComponent from './example-component';
$('.example-component-wrapper').entwine({
onadd: function() {
var component = new ExampleComponent();
component.doStuff();
}
});
クラスと輸出は例-component.jsで予期しないトークンです:
/**
* A component that can do stuff.
*/
class ExampleComponent {
constructor() {
}
doStuff() {
return true;
}
}
export default ExampleComponent;
node_modulesフォルダ内の多くの、多くのそのようなエラーがあります。何か案は?
?あなたの開発環境では、Yeoman自身やNode.jsの何かから? ['import'](https://developer.mozilla.org/ja/docs/web/javascript/reference/statements/import)と[' class'](https://developer.mozilla.org/en/docs)/Web/JavaScript/Reference/Classes)は実際にはECMAScript 6で有効なJSです。 – Turnerj
@Turnerj Dev環境では、Aptana Studio。 – omrakhur
@omrakhur多分これはあなたのための有効な答えです。http://stackoverflow.com/questions/30901152/does-aptana-support-es6 –