mathjs DimensionError thown on load - node.js

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?

Related

Why nodejs error? It's Error 583. How do I fix the fever?

It's an error. Follow the usual method. I want to know how to fix I tried to delete it again and still not missing this error.
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module 'mysql'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (D:\work\test.js:1:75)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module 'mysql'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (D:\work\test.js:1:75)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)

Knex client undefined

Was hoping to see if anyone knows why this error is occurring? I am trying to deploy an app to digital ocean and everything was going well until this.
emphasized text/home/user/koala/server/node_modules/knex/lib/knex.js:33
if (arguments.length === 0 || !config.client && !config.dialect) {
^
TypeError: Cannot read property 'client' of undefined
at Knex (/home/user/koala/server/node_modules/knex/lib/knex.js:33:41)
at Object.<anonymous> (/home/user/koala/server/db/connection.js:5:20)
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)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/user/koala/server/components/account/accountController.js:1:82)
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)
[nodemon] app crashed - waiting for file changes before starting...

Error: Cannot find module '../build/Release/kerberos' on ubuntu in a nodejs project

Error: Cannot find module '../build/Release/kerberos'
at Function.Module._resolveFilename (module.js:548:15)
at Function.Module._load (module.js:475:25)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/mnt/c/Repo/firm-datahub-api/node_modules/authenticate-uxtf/node_modules/kerberos/lib/kerberos.js:1:16)
at Module._compile (module.js:653:30)
at Module._compile (/mnt/c/Repo/firm-datahub-api/node_modules/pirates/lib/index.js:83:24)
at Module._extensions..js (module.js:664:10)
at Object.newLoader [as .js] (/mnt/c/Repo/firm-datahub-api/node_modules/pirates/lib/index.js:88:7)
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> (/mnt/c/Repo/firm-datahub-api/node_modules/authenticate-uxtf/node_modules/kerberos/index.js:2:18)
at Module._compile (module.js:653:30)
at Module._compile (/mnt/c/Repo/firm-datahub-api/node_modules/pirates/lib/index.js:83:24)
at Module._extensions..js (module.js:664:10)
at Object.newLoader [as .js] (/mnt/c/Repo/firm-datahub-api/node_modules/pirates/lib/index.js:88:7)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
I tried every available solution but getting same result.
I installed, kerberos server, client, workstation, what am I missing?

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.

NodeJS application start error

When i try to start my app i see the following error. How can i fix it?
Error: Module version mismatch. Expected 11, got 13.
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/okoz/node_modules/xml2json/node_modules/node-expat/lib/node-expat.js:4:13)
at Module._compile (module.js:456:26)
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)

Resources