silverstripe-module yeoman 生成器中的 JS 意外令牌错误
JS Unexpected token error in silverstripe-module yeoman generator
我最近使用 Yeoman 通过 silverstripe-module 生成器构建了一个新的 Silverstripe 项目。我有 npm 2.15.0,node 是 4.4.2,我还在 运行 生成器之前更新了 lodash。
现在在我的开发环境 (Aptana studio 3) 中,我克隆了一个 git 存储库(它是一个空的私人存储库)和 运行 生成器以在其中构建一个新项目。
一切正常。只是关于更新 graceful-fs 的警告。
但是,在 Javascript 和 node_modules>babel-core 文件夹中弹出了几个 JS 错误。它们都是 "Syntax error: unexpected token " 个错误。
例如。在 javascript 文件夹中,有两个文件,其中甚至像 "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();
}
});
class 和 export 是示例中的意外标记-component.js:
/**
* A component that can do stuff.
*/
class ExampleComponent {
constructor() {
}
doStuff() {
return true;
}
}
export default ExampleComponent;
node_modules文件夹中有很多很多这样的错误。有什么想法吗?
正如上面@FinBoWa 所评论的,是开发环境的问题。它不支持 ES6。
whosebug.com/questions/30901152/does-aptana-support-es6
我最近使用 Yeoman 通过 silverstripe-module 生成器构建了一个新的 Silverstripe 项目。我有 npm 2.15.0,node 是 4.4.2,我还在 运行 生成器之前更新了 lodash。
现在在我的开发环境 (Aptana studio 3) 中,我克隆了一个 git 存储库(它是一个空的私人存储库)和 运行 生成器以在其中构建一个新项目。 一切正常。只是关于更新 graceful-fs 的警告。 但是,在 Javascript 和 node_modules>babel-core 文件夹中弹出了几个 JS 错误。它们都是 "Syntax error: unexpected token " 个错误。 例如。在 javascript 文件夹中,有两个文件,其中甚至像 "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();
}
});
class 和 export 是示例中的意外标记-component.js:
/**
* A component that can do stuff.
*/
class ExampleComponent {
constructor() {
}
doStuff() {
return true;
}
}
export default ExampleComponent;
node_modules文件夹中有很多很多这样的错误。有什么想法吗?
正如上面@FinBoWa 所评论的,是开发环境的问题。它不支持 ES6。
whosebug.com/questions/30901152/does-aptana-support-es6