gruntjs / grunt-cli

Grunt's command line interface.
http://gruntjs.com/
MIT License
706 stars 248 forks source link

Unexpected Token issue with Magento 1 deploy #145

Closed marcel-slp closed 3 years ago

marcel-slp commented 3 years ago

My team was trying to use grunt-cli in order to build and deploy a Magento 1 + Node project. It have been working since last year, but when we tried to use older versions now. The build shows up the following error output:

npm WARN born No license field. 10:12:25 + grunt global-dev 10:12:25 /var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node6/lib/node_modules/grunt-cli/node_modules/micromatch/index.js:44 10:12:25 let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true); 10:12:25 ^^^ 10:12:25 SyntaxError: Unexpected token ... 10:12:25 at createScript (vm.js:56:10) 10:12:25 at Object.runInThisContext (vm.js:97:10) 10:12:25 at Module._compile (module.js:542:28) 10:12:25 at Object.Module._extensions..js (module.js:579:10) 10:12:25 at Module.load (module.js:487:32) 10:12:25 at tryModuleLoad (module.js:446:12) 10:12:25 at Function.Module._load (module.js:438:3) 10:12:25 at Module.require (module.js:497:17) 10:12:25 at require (internal/module.js:20:19) 10:12:25 at Object. (/var/jenkins_home/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/node6/lib/node_modules/grunt-cli/node_modules/findup-sync/index.js:12:10) [Pipeline] } [Pipeline] // wrap [Pipeline] } [Pipeline] // stage [Pipeline] } [Pipeline] // timestamps [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: script returned exit code 1 Finished: FAILURE

We are trying to use old verions, since we know that it used to work before. See the version setup below: { "devDependencies": { "bootstrap-sass": "^3.3.7", "grunt": "1.0.1", "grunt-cli": "^0.1.13", "grunt-contrib-compass": "^1.1.1", "grunt-contrib-copy": "^1.0.0", "grunt-contrib-cssmin": "^1.0.1", "grunt-contrib-qunit": "^1.1.0", "grunt-contrib-requirejs": "^1.0.0", "grunt-contrib-watch": "^1.0.0", "grunt-imagine": "^0.3.6", "grunt-sass": "^1.1.0", "grunt-strip": "^0.2.1", "rjs-build-analysis": "0.0.3" } }

We could find a related issue on Github, however, the fixes didn't work for us (https://github.com/firebase/firebase-tools/issues/1639 / https://github.com/BrowserSync/browser-sync/issues/1682). Could you please help on fix this problem?

vladikoff commented 3 years ago

node6/lib/ your version of node seems very old, at least based on your path. If you update that it should start working

marcel-slp commented 3 years ago

Hi @vladikoff, thank you for your suggestion. Today we are going to install new node version in the server and try to run tthe deploy again. We've tried to call the new version in the Jenkinsfile but now we realized that it needs to be installed. I'll post the results here. Thank you.

marcel-slp commented 3 years ago

Hi @vladikoff, we tried to update the node version, it worked to pass the error message that I posted, however, it broke in other many places. So, going deeper, we could see that our plugin related to NodeJS was overwritting the grut-cli version to the newest one. We just set it manually in Jenkins and it worked. Thank you