0

I am trying to run an SSH on Google Cloud, and I am using node.js.

When I am trying to write node app.js in the ssh console (Ubuntu), I am getting this error:

SyntaxError: Unexpected token =
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/bdognames/serverSystem/msg-system-server/logic/usersLogic.js:3:20)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

The strange part is, when I am running this code on my PC, it works just fine. Can someone please help ?

Ben Ashkenazi
  • 93
  • 2
  • 9
  • 2
    Does this help? https://stackoverflow.com/questions/58374279/syntaxerror-unexpected-token-when-compiling-my-node-js-code I would assume there is some compile issue as well, possible with Babel but your package JSON might be the place to start – Michael Feb 01 '21 at 10:14
  • Thanks for the response, but I did not understand what I should modify within my package.json file – Ben Ashkenazi Feb 01 '21 at 10:34
  • start with looking at babel or es6 compilers, whatever your app uses that might need additional parsing – Michael Feb 01 '21 at 10:35
  • Thanks! The problem was with the node version running on the SSH terminal.... I upgraded it via NVM – Ben Ashkenazi Feb 01 '21 at 10:48

0 Answers0