Node.js Mocha测试在本地运行良好,但在Travis上由于解构语法而失败?

Node.js Mocha测试在本地运行良好,但在Travis上由于解构语法而失败?,node.js,mocha.js,travis-ci,chai,Node.js,Mocha.js,Travis Ci,Chai,我有一个NodeJS+Express应用程序正在运行,我正试图通过Mocha测试来测试我的API。这些测试通过npm脚本(也是Travis调用的同一脚本)在本地运行良好,但在Travis上运行时,我遇到以下错误: > mocha --exit /home/travis/build/tristonpang/restful-web-cs3219/node_modules/mocha/bin/mocha:13 const {deprecate} = require('../lib/utils')

我有一个NodeJS+Express应用程序正在运行,我正试图通过Mocha测试来测试我的API。这些测试通过npm脚本(也是Travis调用的同一脚本)在本地运行良好,但在Travis上运行时,我遇到以下错误:

> mocha --exit
/home/travis/build/tristonpang/restful-web-cs3219/node_modules/mocha/bin/mocha:13
const {deprecate} = require('../lib/utils');
      ^
SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:54:16)
    at Module._compile (module.js:429:25)
    at Object.Module._extensions..js (module.js:464:10)
    at Module.load (module.js:341:32)
    at Function.Module._load (module.js:296:12)
    at Function.Module.runMain (module.js:487:10)
    at startup (node.js:111:16)
    at node.js:809:3
npm ERR! Test failed.  See above for more details.
The command "npm test" exited with 1.
My package.json如下所示:

{
  "name": "task-b",
  "version": "1.0.0",
  "description": "App demonstrating RESTful implentation.",
  "main": "index.js",
  "scripts": {
    "start": "nodemon index",
    "test": "mocha --exit"
  },
  "keywords": [
    "restful"
  ],
  "author": "Triston Pang Erh Syen",
  "license": "ISC",
  "dependencies": {
    "body-parser": "^1.19.0",
    "chai-http": "^4.3.0",
    "express": "^4.17.1",
    "mongoose": "^5.10.3"
  },
  "devDependencies": {
    "chai": "^4.2.0",
    "chai-like": "^1.1.1",
    "mocha": "^8.1.3"
  },
  "babel": {
    "presets": [
      "es2015"
    ]
  }
}

找遍了所有的地方,没有找到任何解决办法,我相当困惑,为什么会发生这种情况,任何帮助将不胜感激

我发现了问题,是
.travis.yml
文件中的一个输入错误将节点版本设置为1.0.0,远远早于引入解构