1

We are using grunt to build our angularjs application. GruntFile.js contains war:target task to create war file.

Its working locally but not while running jenkins build.

We have 2 different jobs running with following npm and node version. In 1 job war is getting created and in other war creation failing.

npm info using npm@5.6.0
npm info using node@v8.11.4 

Running "war:target" (war) task Warning: Unexpected token * Use --force to continue. Aborted due to warnings.

Stack trace for reference

Warning: Unexpected token * Use --force to continue.
/tmp/workspace/dept-dev-my-angular-app-17486/dept-dev-my-angular-app-17486-my-angular-app-ui.feature-develop/node_modules/readdir-glob/index.js:62
async function* exploreWalkAsync(dir, path, followSyslinks, useStat, shouldSkip, strict) {
              ^

SyntaxError: Unexpected token *
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:616:28)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
    at Module.require (module.js:596:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/tmp/workspace/dept-dev-my-angular-app-17486/dept-dev-my-angular-app-17486-my-angular-app-ui.feature-develop/node_modules/archiver/lib/core.js:9:12)

Could you please advise on this ?

StackOverFlow
  • 4,486
  • 12
  • 52
  • 87
  • 1
    Looks like the version of node.js being used where it's failing does not support [async generator functions](http://kangax.github.io/compat-table/es2016plus/#test-Asynchronous_Iterators_async_generators). Have you tried upgrading the version of node.js to the same version (or newer) to that being used locally? In [issue #3](https://github.com/Yqnn/node-readdir-glob/issues/3) for the `readdir-glob` package it suggests using node.js `>=10`. – RobC May 10 '21 at 12:59
  • @RobC we are migrating ui project with same code and config. We have 2 different jenkins jobs running with npm (5.6.0)and node(8.11.4) version. In 1 job war is getting created and in other war creation failing. Nodejs version may not be problem. Please advise. – StackOverFlow May 11 '21 at 05:39
  • As the message suggests, the configuration of `grunt` might differ between both instances. This question explains [how to ignore warnings of grunt]( https://stackoverflow.com/questions/15423851/how-do-you-make-grunt-js-not-crash-on-warnings-by-default). – Constantin Konstantinidis May 12 '21 at 18:43
  • @Constantin Konstantinidis I already user force true to avoid warning but it's not create war file – StackOverFlow May 14 '21 at 04:59
  • When using flag `--force`, is any other message displaying ? – Constantin Konstantinidis May 14 '21 at 05:02
  • @Constantin Konstantinidis its just ignores warning and skip war creation – StackOverFlow May 14 '21 at 05:28
  • The question seems to revolve around a differing behavior of two Jenkins entities. Even with `--force` flag, the warning is still detected by Jenkins. It is not uncommon to tolerate warnings only on the development entity. – Constantin Konstantinidis May 14 '21 at 05:58
  • Regarding the async error, this [question](https://stackoverflow.com/questions/37815790/syntaxerror-unexpected-token-function-async-await-nodejs) has the details. – Constantin Konstantinidis May 14 '21 at 06:00
  • @ConstantinKonstantinidis - that [question](https://stackoverflow.com/questions/37815790/syntaxerror-unexpected-token-function-async-await-nodejs) that you linked to refers to _async_ functions, however the error show in the OP indicates _async generator functions_ (note the `*`) - As per my first comment _async generator functions_ are supported in node.js `>=10`. – RobC May 14 '21 at 06:14
  • @StackOverFlow are you using codedeploy ? In that case you can run the grunt command on server start script in appsec.yml. You can install grunt on your instance globally with nodejs can create ami for replication purpose. In your case it must be the version diff on jenkin server. – Subhanshu May 16 '21 at 14:14

0 Answers0