运行gulp启动时出错

时间:2018-06-25 16:57:11

标签: npm gulp

我正在搜索,但找不到错误。 现在我希望有人帮助我。

npm -v

[18:54:13]需要外部模块babel-core / register
[18:54:13] CLI版本3.9.0
[18:54:13]本地版本3.9.0

gulp -v

5.6.0

$ gulp start
[18:47:59] Requiring external module babel-core/register
/node_modules/babel-core/lib/transformation/file/index.js:558
      throw err;
      ^

SyntaxError: /config/index.js: Unexpected token (31:17)
  29 | const bothConfig = require('./both');
  30 | 
> 31 | export default { ...bothConfig, ...envConfig };
     |                  ^
  32 | 
    at Parser.pp$5.raise (/node_modules/babylon/lib/index.js:4454:13)
    at Parser.pp.unexpected (/node_modules/babylon/lib/index.js:1761:8)
    at Parser.pp$3.parseIdentifier (/node_modules/babylon/lib/index.js:4332:10)
    at Parser.pp$3.parsePropertyName (/node_modules/babylon/lib/index.js:4156:96)
    at Parser.parsePropertyName (/node_modules/babylon/lib/index.js:6229:23)
    at Parser.pp$3.parseObj (/node_modules/babylon/lib/index.js:4045:12)
    at Parser.pp$3.parseExprAtom (/node_modules/babylon/lib/index.js:3719:19)
    at Parser.parseExprAtom (/node_modules/babylon/lib/index.js:7238:22)
    at Parser.pp$3.parseExprSubscripts (/node_modules/babylon/lib/index.js:3494:19)
    at Parser.pp$3.parseMaybeUnary (/node_modules/babylon/lib/index.js:3474:19)

2 个答案:

答案 0 :(得分:0)

export default{bothConfig, envConfig};

答案 1 :(得分:0)

错误消失了,但是现在我有了一个新错误。

SyntaxError:/config/server.js:意外令牌(50:29)

const getConfiguration = () => {
  try {
    return { config, require('./json/server.json') }; // eslint-disable-line import/no-unresolved
  } catch (error) {
    return config;
  }
};

在这一个中:('./json/server.json')