背景
用jenkins配置vue前端代码部署,要执行yarn install && yarn build:dev 命令。配置了构建脚本后运行jenkins发现报错
const wslToWindowsPath = async path => { ^^^^ SyntaxError: Unexpected identifier at createScript (vm.js:56:10) at Object.runInThisContext (vm.js:97:10) at Module._compile (module.js:542:28) at Object.Module._extensions..js (module.js:579:10) 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 Object.<anonymous> (/var/lib/jenkins/workspace/OKR-FE-DEV/node_modules/@vue/cli-shared-utils/lib/openBrowser.js:9:14) error Command failed with exit code 1.
这个问题和https://www.cnblogs.com/qingshan-tang/p/13035348.html 一致,就是node版本太低的原因。同样需要安装高版本jenkins node 插件。
解决
安装高版本jenkins node 插件