我正试图跑#34; gulp"命令在我的反应应用程序中但我收到错误说
D:\te-client-2>gulp
[23:15:25] Requiring external module babel-register
D:\tessact-client-2\gulpfile.babel.js:1
(function (exports, require, module, __filename, __dirname) { import gulp from 'gulp';
^^^^^^
SyntaxError: Unexpected token import
at Object.exports.runInThisContext (vm.js:76:16)
at Module._compile (module.js:542:28)
at loader (D:\te-client-2\node_modules\babel-register\lib\node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (D:\te-client-2\node_modules\babel-register\lib\node.js:154:7)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Liftoff.handleArguments (C:\Users\ap\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:116:3)
原因是什么,我该如何解决?
答案 0 :(得分:0)
我的项目缺少.babelrc文件。我刚刚添加了文件,并在其中添加了以下代码行
{
"presets": [ "es2015", "stage-0", "react" ]
}