如何在Jenkins服务器上运行Jesttesting

我试图在Jenkins部署期间运行我的Jesttesting。 如果我SSH入服务器,我可以sudo到jenkins用户ans成功运行testing从工作区。 但是,当我尝试从GUI构build项目时出现错误。 这是我的项目设置:

我已经安装了nodejs插件,它在全球安装gulp,jest-cli和babel。 在这里输入图像描述

然后在构build步骤中:

在这里输入图像描述

testing失败,出现此错误:

TypeError: Cannot read property 'getResourceByPath' of null at Loader.getDependenciesFromPath (/var/lib/jenkins/workspace/PHPStaging/node_modules/jest-cli/src/HasteModuleLoader/HasteModuleLoader.js:570:39) at /var/lib/jenkins/workspace/PHPStaging/node_modules/jest-cli/src/TestRunner.js:250:22 at process._tickCallback (node.js:368:9) Running 6 test suites... FAIL resources/__tests__/myTest.js` 

看来Node在testing中遇到了需要模块的麻烦,但我并不完全确定。 任何帮助或方向将不胜感激。