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 ?
Related
I successfully run this pdf viewer from mozilla/pdf.js to my windows. But when I'm trying to install it to my centos 7 machine I'm getting this error when running gulp server.
[root#localhost pdf.js]# gulp server
/root/Desktop/node.prod/pdf.js/gulpfile.js:232
output.library?.type === "module" ? { outputModule: true } : undefined;
^
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 requireOrImport (/usr/lib/node_modules/gulp/node_modules/gulp-cli/lib/shared/require-or-import.js:19:11)
at execute (/usr/lib/node_modules/gulp/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js:37:3)
at Liftoff.handleArguments (/usr/lib/node_modules/gulp/node_modules/gulp-cli/index.js:211:24)
I have been working on a project and recently, in Circle CI pipelines, I started to get this error.
/root/project/node_modules/fs-extra/lib/mkdirs/make-dir.js:85
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/root/project/node_modules/fs-extra/lib/mkdirs/index.js:3:44)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
I see some discussions about it online.
https://github.com/google/docsy/issues/265
https://www.gitmemory.com/issue/jprichardson/node-fs-extra/790/614647362
The nodejs version is 12.16.1
The fs-extra version is 9.0.1, in the cases, it was mentioned as ^9.0.0.
Does anyone know where this error comes from, and how to fix it? It seems like I am aligned with my node version (over v10) and the fs-extra. I prefer not to downgrade unless it is the only solution atm.
Need help on following error , same setup works on localhost but when I try to run on production server received following error.
Kafka and zookeeper are setup on same server
===========================
/var/www/html/kafka-server/node_modules/kafka-node/lib/utils.js:23
throw new InvalidConfigError(`topic name is illegal, cannot be longer th
^
SyntaxError: Unexpected token ILLEGAL
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> (/var/www/html/kafka-server/node_modules/kafka-node/lib/highLevelConsumer.js:11:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
===========================
I'm getting an error importing the Firebase npm module with an app hosted by OpenShift.
The following line
firebase = require('firebase/app'),
produces the following output in the log file
TypeError: Cannot use 'in' operator to search for '$__firebase' in undefined at /var/lib/openshift/57408de67628e1e65b00006a/app-root/runtime/repo/node_modules/firebase/app-node.js:19:449
at Object.<anonymous> (/var/lib/openshift/57408de67628e1e65b00006a/approot/runtime/repo/node_modules/firebase/app-node.js:19:617)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/lib/openshift/57408de67628e1e65b00006a/app-root/runtime/repo/node_modules/firebase/firebase-node.js:8:18)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at /var/lib/openshift/57408de67628e1e65b00006a/app-root/runtime/repo/app.js:12:20
The strange thing is that if I execute
$ node app.js
there is no error and the app runs fine.
Try removing the --use-strict option in package.json, if you are using the cartridge with start.js and cluster.
See this stackoverflow q&a for more details on strict mode: in-node-js-how-the-use-strict-statement-is-interpreted
Hope it helps!
I successfully installed parse dashboard using the commands on the github repo.
When I try to run it from the command line I get the following error
/usr/local/lib/node_modules/parse-dashboard/Parse-Dashboard/index.js:10
const path = require('path');
^^^^^
SyntaxError: Use of const in strict mode.
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/usr/local/lib/node_modules/parse-dashboard/bin/parse-dashboard:2:1)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
Any one have any idea of what is going on here and how I can fix it?