I have a Node.JS (version 8.6) based Google Home app that uses the Actions on Google Javascript client library. It has built and ran fine for several days now. I added a few packages to the project and all of a sudden I start getting the following fatal error in the Actions on Google Javascript client library, despite the fact the code in that library has not been touched:
/**
* The Actions on Google client library.
* https://developers.google.com/actions/
*/
'use strict';
const AssistantApp = require('./assistant-app');
^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/roschler/Documents/GitHub/YourMD/google-assistant/morse-integration/routes/fulfillment.js:16:21)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
I never got this error before. Below is my package.json file:
{
"name": "test",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"aws-sdk": "^2.3.17",
"actions-on-google": "^1.4.0",
"archiver": "^1.3.0",
"body-parser": "~1.13.3",
"bluebird": "^3.4.0",
"cookie-parser": "~1.3.5",
"config": "^1.21.0",
"debug": "~2.2.0",
"express": "~4.13.1",
"glob": "~7.0.3",
"http-status-codes": "~1.0.6",
"jade": "~1.11.0",
"jsonfile": "~2.2.3",
"marked": "^0.3.5",
"morgan": "~1.6.1",
"pg": "^6.1.4",
"redis": "^2.6.1",
"request": "^2.72.0",
"scribe-js": "~2.0.4",
"serve-favicon": "~2.3.0",
"showdown": "^1.7.1",
"simple-spinner": "0.0.5",
"ssl-root-cas": "~1.2.2",
"underscore": "^1.8.3"
}
}
Does anyone know why this is happening and what I can do to fix it? I tried updating my Node.JS version as per the accepted answer the Stack Overflow post below regarding a similar error, but it did not help:
SyntaxError: Use of const in strict mode?
I still get the error.
UPDATE: I forgot that I also upgraded from Node 7.2 to 8.6. I believe now that's what is causing my issues. I'm in the process of doing a full purge of Node.js and then installing nvm so I can test versions.