背景
用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 插件