Sails.js unit testing getting uncaught error - sails.js

Being working with sails.js and i was writing test cases using MOCHA and grunt am getting Uncaught error. I searched over net but i didn't get clear solution. how to get started with sails.js unit testing?
1) "before all" hook:
Uncaught Error: listen EADDRINUSE
at exports._errnoException (util.js:746:11)
at Server._listen2 (net.js:1156:14)
at listen (net.js:1182:10)
at Server.listen (net.js:1267:5)
at Object.module.exports.bootstrap (config/bootstrap.js:16:3)
this above error am getting while running 'grunt test', thanks.

Update:
Actually there are two servers running so that created this issue. just kill one server it works fine.

Related

having issues with "dfx start" and "dfx deploy" code

Does anyone know the solution to this? I am new to this and learning. I am on Macbook Air m1.
This is the end code while running dfx start in the terminal:
thread 'replica-actor' panicked at 'called Result::unwrap() on an Err value: Cannot start the replica: Timeout', src/dfx/src/actors/replica.rs:279:78
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
This is what happens while running dfx deploy in terminal:
Error: An error happened during communication with the replica: error sending request for url (http://127.0.0.1:8000/api/v2/status): error trying to connect: tcp connect error: Connection refused (os error 61)
Does anyone know anything about this?
Found the solution to the problem. I was running the code while it was stored in an external drive. When I created the same folder on my desktop and ran everything the same way, the problem got solved and I no longer have those errors in my terminal. I don't know how it is happening, but I just discovered it right now.
Try "dfx start --emulator"

Sails.js + MongoDB when lifting often throw error "`orm` is taking too long to load"

Why the error
`Error: The hook 'orm' is taking too long to load.`
It occurs very often when sails is lifting? Even orm timeout already set to 100000, it still occur sometimes (not always). Usually it happen after PC has been restarted and sails run at first time.
It also often occur at cloud server and my laptop beside my PC. So it occur at my tested environment:
Windows 8.1 (PC and laptop) and Linux (Ubuntu 14.04)
node.js version 0.10.38
sails version 0.11
MongoDB version 3
The complete error report is like this
error: Error: The hook `orm` is taking too long to load.
Make sure it is triggering its `initialize()` callback, or else set `sails.config.orm._hookTimeout to a higher value (currently 20000)
at [object Object].tooLong [as _onTimeout] (D:\Workspace\Hellowin\cannes\node_modules\sails\lib\app\private\loadHooks.js:92:21)
at Timer.listOnTimeout [as ontimeout] (timers.js:112:15) { [Error: The hook `orm` is taking too long to load.
Make sure it is triggering its `initialize()` callback, or else set `sails.config.orm._hookTimeout to a higher value (currently 20000)] code: 'E_HOOK_TIMEOUT' }
D:\Workspace\Hellowin\cannes\node_modules\sails\node_modules\async\lib\async.js:30
if (called) throw new Error("Callback was already called.");
^
Error: Callback was already called.
at D:\Workspace\Hellowin\cannes\node_modules\sails\node_modules\async\lib\async.js:30:31
at process._tickDomainCallback (node.js:492:13)
Is it a MongoDB adapter bug?
I have encountered the same error recently and found syntax error in one of my model. Now it is working fine. SO basically this error occurs because of some error related to the database. you can check your models, connection, etc..

Couldn't register com.xxx.appname with the bootstrap server. Error: unknown error code.Program received signal: “SIGABRT”

I am getting this error while running in device.
Couldn't register com.xxxx.appname with the bootstrap server.
Error: unknown error code.
This generally means that another instance of this process was already running or is hung in the debugger.Program received signal: “SIGABRT”.
Now i rectified this problem .I have posted answer also if anyone got this error follow my post..
Try this,
Deleteing the app, restarting Xcode, clean build, didn't do anything
--> restart your computer
--> restart the phone

Fatal error: Uncaught CurlException: 7: couldn't connect to host thrown in

Yesterday was fine, but today, suddenly, my web app report an error while accessing Facebook PHP API.
At first, the error was connection time out. So, I added the time in base_facebook.php, changed the variable
CURLOPT_CONNECTTIMEOUT => 10 into
CURLOPT_CONNECTTIMEOUT => 60
Now, my web app reports another error:
Fatal error: Uncaught CurlException: 7: couldn't connect to host thrown in xxx\src\base_facebook.php on line 972
Ah, I run my app on localhost in Windows (XAMPP 1.7.7).
For testing it, I also run the example codes from the newest facebook API in github.
I also have restarted my Apache server, and It still gives the same error.
This is probably a server configuration problem on your side.
Check whether the host has blocked the ports 80 and 443.

Derby app created using 'derby new test' not working

I've installed derbyjs using npm install -g derby and then created a test app using derby new test.
Then i started the app using node server.js and I got the following output:
info - socket.io started
Starting cluster with 1 workers in undefined mode
`kill -s SIGUSR2 7161` to force cluster reload
Go to: http://localhost:3000/
info - socket.io started
So I tried to request http://localhost:3000/, but the site does not finish loading and I get the following exception:
TEMPLATE ERROR
Error: Model mutation performed after bundling for clientId: 79f4a9f3-25fc-438d-b9f4-a450dccf9566
at Model.errorOnCommit [as _commit] (/web/derby/test/node_modules/derby/node_modules/racer/lib/bundle/bundle.Model.js:64:9)
at /web/derby/test/node_modules/derby/node_modules/racer/lib/txns/txns.Model.js:120:15
at next (/web/derby/test/node_modules/derby/node_modules/racer/lib/middleware.js:7:26)
at /web/derby/test/node_modules/derby/node_modules/racer/lib/txns/txns.Model.js:107:16
at next (/web/derby/test/node_modules/derby/node_modules/racer/lib/middleware.js:7:26)
at /web/derby/test/node_modules/derby/node_modules/racer/lib/txns/txns.Model.js:101:16
at next (/web/derby/test/node_modules/derby/node_modules/racer/lib/middleware.js:7:26)
at /web/derby/test/node_modules/derby/node_modules/racer/lib/txns/txns.Model.js:92:16
at next (/web/derby/test/node_modules/derby/node_modules/racer/lib/middleware.js:7:26)
at Object.run (/web/derby/test/node_modules/derby/node_modules/racer/lib/middleware.js:10:12)
events.js:68
throw arguments[1]; // Unhandled 'error' event
^
Error: Cannot write after end
at Gzip.write (zlib.js:311:31)
at ServerResponse.res.write (/web/derby/test/node_modules/express/node_modules/connect/lib/middleware/compress.js:82:18)
at Object.View._render (/web/derby/test/node_modules/derby/lib/View.server.js:337:9)
at /web/derby/test/node_modules/derby/lib/View.server.js:276:10
at Array.2 (/web/derby/test/node_modules/derby/lib/View.server.js:300:5)
at Object.Promise.resolve (/web/derby/test/node_modules/derby/node_modules/racer/lib/util/Promise.js:21:19)
at /web/derby/test/node_modules/derby/lib/View.server.js:136:17
at /web/derby/test/node_modules/derby/lib/files.js:224:7
at Object.oncomplete (fs.js:308:15)
at process._makeCallback (node.js:248:20)
I have absolutely no idea how I can get it running... Is it a bug, or am I doing something wrong?
Update
I've created a bug report on the derby repository: https://github.com/codeparty/derby/issues/170