Parse dashboard error - node.js

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?

Related

node server.js throws error

running node server.js just throws error like this.
anyone knows why ??
/xxxxxx/server/node_modules/connect/node_modules/mime/index.js:3
const Mime = require('./Mime');
^^^^^
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> (/xxxxxx/server/node_modules/connect/lib/middleware/static.js:21:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)

Gulp SintaxError : Unexpected identifier

I try to edit a Gulp app on my local server.
I thought it could something with ES6 or version, but I tried so hard and nothing.
I always have this error:
/var/www/html/carros/gulpfile.js:11
let dev = true;
^^^
SyntaxError: Unexpected identifier
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 Liftoff.handleArguments (/usr/local/lib/node_modules/gulp/bin/gulp.js:116:3)
at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:198:16)
at module.exports (/usr/local/lib/node_modules/gulp/node_modules/liftoff/node_modules/flagged-respawn/index.js:17:3)
at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:190:9)

throw new InvalidConfigError(`topic name is illegal, cannot be longer than ${allowedTopicLength} characters)

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)
===========================

mathjs DimensionError thown on load

Trying to use the mathjs module for some matrix maths in NodeJS. The require statement seems to throw an exception
var math = require("mathjs");
Exception is:
DimensionError
at Object.<anonymous> (C:\Users\jon_000\workspace\RobotInvKin\node_modules
\mathjs\lib\error\DimensionError.js:30:28)
at Module._compile (module.js:460:26)
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> (C:\Users\jon_000\workspace\RobotInvKin\node_modules
\mathjs\lib\utils\array.js:8:22)
at Module._compile (module.js:460:26)
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> (C:\Users\jon_000\workspace\RobotInvKin\node_modules
\mathjs\lib\utils\index.js:3:17)
This must be something simple. Any ideas gratefully received?

Can't run tests with Mocha on Express.js app

I am trying to setup mocha to test an ExpressJs app.
When I run tests using npm test I got the following error:
TypeError: undefined is not a function
at Object.<anonymous> (/myapp/bin/www:11:18)
at Module._compile (module.js:460:26)
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 Function.cls_wrapMethod (/Users/nathanzylbersztejn/git/airdesk-api/node_modules/newrelic/lib/shimmer.js:230:38)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/nathanzylbersztejn/git/airdesk-api/controllers/session.js:13:11)
at Module._compile (module.js:460:26)
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 Function.cls_wrapMethod (/Users/nathanzylbersztejn/git/airdesk-api/node_modules/newrelic/lib/shimmer.js:230:38)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/nathanzylbersztejn/git/airdesk-api/app.js:10:25)
at Module._compile (module.js:460:26)
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> (/Users/nathanzylbersztejn/git/airdesk-api/test/test.js:5:11)
at Module._compile (module.js:460:26)
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 /Users/nathanzylbersztejn/git/airdesk-api/node_modules/mocha/lib/mocha.js:185:27
at Array.forEach (native)
at Mocha.loadFiles (/Users/nathanzylbersztejn/git/airdesk-api/node_modules/mocha/lib/mocha.js:182:14)
at Mocha.run (/Users/nathanzylbersztejn/git/airdesk-api/node_modules/mocha/lib/mocha.js:394:31)
at loadAndRun (/Users/nathanzylbersztejn/git/airdesk-api/node_modules/mocha/bin/_mocha:349:22)
at Object.<anonymous> (/Users/nathanzylbersztejn/git/airdesk-api/node_modules/mocha/bin/_mocha:366:3)
at Module._compile (module.js:460:26)
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 Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Where /myapp/bin/www:11:5 refers to the following line:
var app = require('../app')
app.set('port', process.env.PORT || 3000); // <- this line
^
The app works well, so it's not related to the app setup.
Any idea?
First guess is you have a circular dependency, which node handles by returning an empty object until the circle is finished. Do you do something like require("./bin/www"); inside app.js?
If you post app.js and bin/www we should be able to confirm.
Second guess is app.js just isn't getting the commonjs exports correct.
I'm also pretty sure you should be able to test your express app with supertest loading just app.js and leaving bin/www just for when you launch a real server instance.

Resources