无法 运行 mocha 测试
Can't run mocha tests
我在某个文件夹中有一些 nodejs 应用程序,似乎我无法 运行 任何 mocha 测试,当我 运行 npm 测试或 mocha 测试时我得到这个:
/home/jmartinez/uni/mis_practicas/p5-t1-egg-0-alu0100921038/node_modules/mocha/lib/cli/run-helpers.js:84
exports.handleRequires = async (requires = []) =>
^
SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/jmartinez/uni/mis_practicas/p5-t1-egg-0-alu0100921038/node_modules/mocha/lib/cli/options.js:15:16)
我再次尝试重新安装 mocha,但没有任何效果,错误仍然存在,而且我不知道如何修复它,我只是像其他人一样安装。这个错误发生在每个 nodejs 应用程序中,所以它看起来像是一个安装问题,但重新安装并没有解决它。
我正在使用节点版本 v6.17.1
嗯,看来 nodejs 的版本 6 已经很旧了。我升级到 12,现在可以正常工作了。
我在某个文件夹中有一些 nodejs 应用程序,似乎我无法 运行 任何 mocha 测试,当我 运行 npm 测试或 mocha 测试时我得到这个:
/home/jmartinez/uni/mis_practicas/p5-t1-egg-0-alu0100921038/node_modules/mocha/lib/cli/run-helpers.js:84
exports.handleRequires = async (requires = []) =>
^
SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/home/jmartinez/uni/mis_practicas/p5-t1-egg-0-alu0100921038/node_modules/mocha/lib/cli/options.js:15:16)
我再次尝试重新安装 mocha,但没有任何效果,错误仍然存在,而且我不知道如何修复它,我只是像其他人一样安装。这个错误发生在每个 nodejs 应用程序中,所以它看起来像是一个安装问题,但重新安装并没有解决它。
我正在使用节点版本 v6.17.1
嗯,看来 nodejs 的版本 6 已经很旧了。我升级到 12,现在可以正常工作了。