0

While building application with Teamcity 9.1.7 we are getting below error -

const os = require('os'); ^^^^^

Loading "Gruntfile.js" tasks...ERROR

SyntaxError: Use of const in strict mode.

Any help is greatly appriciated

Krishna Kumar Chourasiya
  • 2,030
  • 3
  • 20
  • 23

1 Answers1

0

add 'use strict'; to the top of the file. Or better update your node.js

'use strict';
const os = require('os');
// rest of the file

For your version of node (6.11.3 as you've mentioned in comment) everything should works fine. I've just checked

enter image description here

Vasiliy vvscode Vanchuk
  • 7,007
  • 2
  • 21
  • 44
  • We are already using 'use strict' at the top of the file. And we have node version 6.11.3 and npm 3.10.9 – Krishna Kumar Chourasiya May 10 '18 at 11:41
  • @KrishnaKumarChourasiya could you show full file? https://monosnap.com/file/9iuvhykqhUkhgyzIEayX9ArNsIc4Fg I've just tested at the same version of node and everything works fine, even without that string. Please show output on your node version – Vasiliy vvscode Vanchuk May 10 '18 at 12:11
  • There is teamcity job which build our application with node npm and yarn supports. During building the application in node_modules/supports-color/index.js at line2, having this code which is creating problem that I can't modify. – Krishna Kumar Chourasiya May 11 '18 at 05:07
  • @KrishnaKumarChourasiya still waiting for certain and correct node version – Vasiliy vvscode Vanchuk May 11 '18 at 16:24