Sometimes, my (large) application gives the following error:
Error: write after end
at ServerResponse.OutgoingMessage.write(_http_outgoing.js:413:15)
at ServerResponse.res.write(/nodeapp/node_modules/express/node_modules/connect/lib/middleware/compress.js:110:17)
at ServerResponse.res.end(/nodeapp/node_modules/express/node_modules/connect/lib/middleware/compress.js:116:14)
at ServerResponse.res.send(/nodeapp/node_modules/express/lib/response.js:153:8)
at fn(/nodeapp/node_modules/express/lib/response.js:797:10)
at/nodeapp/node_modules/vash/build/vash.js:2082:4
at Object.vash.loadFile (/nodeapp/node_modules/vash/build/vash.js:2070:10)
at View.vash.renderFile [as engine] (/nodeapp/node_modules/vash/build/vash.js:2078:8)
at View.render (/nodeapp/node_modules/express/lib/view.js:76:8)
at Function.app.render (/nodeapp/node_modules/express/lib/application.js:504:10)
Is there a way to find out in which line this error happend? Normally the file is mentioned in the stack trace, but not in this case. Is it even from my code or can it also be caused by vash or another module?
I am using vash v0.7.12-1.
I solved it by increasing the stacktrace limit:
Error.stackTraceLimit = 20;
Related
Greenie here. Trying to start with a new Express project and I already hit a snag. I used the generator to start my app (express --view=handlebars sms_alarm_nodejs) and I got this error:
Error: Failed to lookup view "error" in views directory "c:\Users\joe_t\workspace\sms_alarm_nodejs\views"
application.js:630
at Function.render (c:\Users\joe_t\workspace\sms_alarm_nodejs\node_modules\express\lib\application.js:580:17)
at ServerResponse.render (c:\Users\joe_t\workspace\sms_alarm_nodejs\node_modules\express\lib\response.js:971:7)
at c:\Users\joe_t\workspace\sms_alarm_nodejs\app.js:43:7
at Layer.handle_error (c:\Users\joe_t\workspace\sms_alarm_nodejs\node_modules\express\lib\router\layer.js:71:5)
at trim_prefix (c:\Users\joe_t\workspace\sms_alarm_nodejs\node_modules\express\lib\router\index.js:315:13)
at c:\Users\joe_t\workspace\sms_alarm_nodejs\node_modules\express\lib\router\index.js:284:7
at Function.process_params (c:\Users\joe_t\workspace\sms_alarm_nodejs\node_modules\express\lib\router\index.js:335:12)
at next (c:\Users\joe_t\workspace\sms_alarm_nodejs\node_modules\express\lib\router\index.js:275:10)
at Layer.handle_error (c:\Users\joe_t\workspace\sms_alarm_nodejs\node_modules\express\lib\router\layer.js:67:12)
at trim_prefix (c:\Users\joe_t\workspace\sms_alarm_nodejs\node_modules\express\lib\router\index.js:315:13)
Am I missing a view reference in app.js? I assumed the app generator would handle this for me to start. And can I use handlebars? The sample I saw used pug.
Fixed it. I had to use --view=hbs as the generator parameter.
I am using ejs-local to render views for my node.js application. I saw lots of too many open files" exception when rendering views:
Error: EMFILE, too many open files '/home/user/app/views/index.html'
at Object.fs.openSync (fs.js:432:18)
at fs.readFileSync (fs.js:289:15)
at Object.exports.renderFile (/home/wangchen/bweb_auto/node_modules/ejs-locals/node_modules/ejs/lib/ejs.js:313:9)
at View.module.exports [as engine] (/home/user/app/node_modules/ejs-locals/index.js:85:7)
at View.render (/home/user/app/node_modules/express/lib/view.js:76:8)
at Function.app.render (/home/user/app/node_modules/express/lib/application.js:506:10)
at ServerResponse.res.render (/home/user/app/node_modules/express/lib/response.js:759:7)
at /home/user/app/routes/index.js:226:17
at Query._callback (/home/user/app/node_modules/orm/lib/ChainFind.js:190:13)
at Query.Sequence.end (//home/user/appode_modules/mysql/lib/protocol/sequences/Sequence.js:75:24)
Which tear down the entire website. Although seemingly adding ulimit might solve this problem: it current is set to 1024. I am more concerned about possible bug in ejs code/node, that didn't close the file when necessary.
Have you come across similar thing?
I was trying to put an implicit wait in selenium java script with mocha but i see the following error:
ReferenceError: timeUnit is not defined
Below is the code snippet i used:
driver.manage().timeouts().implicitlyWait(20, timeUnit.SECONDS);
and the stack trace I see is:
at Context.<anonymous> (C:\node_modules\Script\login_scenario.js:32:50)
at C:\node_modules\Script\node_modules\selenium-webdriver\testing\index.js:142:19
at new promise.Promise (C:\node_modules\Script\node_modules\selenium-webdriver\lib\webdriver\promise.js:355:5)
at controlFlowExecute (C:\node_modules\Script\node_modules\selenium-webdriver\testing\index.js:127:14)
at promise.ControlFlow.runInFrame_ (C:\node_modules\Script\node_modules\selenium-webdriver\lib\webdriver\promise.js:1877:20)
at promise.ControlFlow.runEventLoop_ (C:\node_modules\Script\node_modules\selenium-webdriver\lib\webdriver\promise.js:1755:8
at null.<anonymous> (C:\node_modules\Script\node_modules\selenium-webdriver\lib\webdriver\promise.js:2056:12)
at goog.async.run.processWorkQueue (C:\node_modules\Script\node_modules\selenium-webdriver\lib\goog\async\run.js:125:21)
: Task: Automation of Shop Management Login scenario
at Context.ret (C:\node_modules\Script\node_modules\selenium-webdriver\testing\index.js:126:10)
at Test.Runnable.run (C:\Users\kashyap\AppData\Roaming\npm\node_modules\mocha\lib\runnable.js:233:15)
at Runner.runTest (C:\Users\kashyap\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:387:10)
at C:\Users\kashyap\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:470:12
at next (C:\Users\kashyap\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:312:14)
at C:\Users\kashyap\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:322:7
at next (C:\Users\kashyap\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:257:23)
at Immediate._onImmediate (C:\Users\kashyap\AppData\Roaming\npm\node_modules\mocha\lib\runner.js:289:5)
at processImmediate [as _immediateCallback] (timers.js:358:17)
implicitlyWait() in javascript selenium bindings accepts a single argument - a timeout in milliseconds:
driver.manage().timeouts().implicitlyWait(20000);
You are probably mixing it up with implicitlyWait() method from java selenium bindings, which allows you to specify the timeout unit alongside with the timeout itself.
After I installed lodash or async plug-ins,
Console shows those error messages when I launch sails.js.
but I don't know what cause those error messages.
I need to solve this problem. please anyone help me.
error: A hook (`userconfig`) failed to load!
error: Error: Invalid module:[object Object]
at /Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:83:15
at forOwn (/Users/johndo/github/sails/testProject/node_modules/lodash/dist/lodash.js:2105:15)
at Function.forEach (/Users/johndo/github/sails/testProject/node_modules/lodash/dist/lodash.js:3302:9)
at buildDictionary (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:74:4)
at Function.module.exports.aggregate (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:190:9)
at Array.loadOtherConfigFiles [as 0] (/Users/johndo/github/sails/testProject/node_modules/sails/lib/hooks/moduleloader/index.js:164:27)
at /Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:459:38
at Array.forEach (native)
at _each (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:32:24)
at Object.async.auto (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:430:9) [Error: Invalid module:[object Object]]
error: Error: Invalid module:[object Object]
at /Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:83:15
at forOwn (/Users/johndo/github/sails/testProject/node_modules/lodash/dist/lodash.js:2105:15)
at Function.forEach (/Users/johndo/github/sails/testProject/node_modules/lodash/dist/lodash.js:3302:9)
at buildDictionary (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:74:4)
at Function.module.exports.aggregate (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/sails-build-dictionary/index.js:190:9)
at Array.loadOtherConfigFiles [as 0] (/Users/johndo/github/sails/testProject/node_modules/sails/lib/hooks/moduleloader/index.js:164:27)
at /Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:459:38
at Array.forEach (native)
at _each (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:32:24)
at Object.async.auto (/Users/johndo/github/sails/testProject/node_modules/sails/node_modules/async/lib/async.js:430:9) [Error: Invalid module:[object Object]]
It looks like it's experiencing an error while parsing your configuration files. Try rolling back your changes.
Also, lodash and async come as globals in sails, so you don't need to install them. Just go to config/globals and uncomment _(lodash). That might fix your problem, as maybe sails is having a conflict between its installed version and yours.
Eror: url must be a relative URL: http://www.mafengwo.com/
at _.extend.classify (packages/routepolicy/routepolicy.js:103)
at Object.Inject.appUrl (packages/meteorhacks:inject-initial/lib/inject-core.js:43)
at Object.Package [as handle] (packages/gadicohen:headers/headers-server.js:192)
at next (/home/timekeeper/bundle/programs/server/npm/webapp/node_modules/connect/lib/proto.js:190:15)
at next (/home/timekeeper/bundle/programs/server/npm/webapp/node_modules/connect/lib/proto.js:165:78)
at Function.app.handle (/home/timekeeper/bundle/programs/server/npm/webapp/node_modules/connect/lib/proto.js:198:3)
at Object.fn [as handle] (/home/timekeeper/bundle/programs/server/npm/webapp/node_modules/connect/lib/proto.js:74:14)
at next (/home/timekeeper/bundle/programs/server/npm/webapp/node_modules/connect/lib/proto.js:190:15)
at Object.WebAppInternals.staticFilesMiddleware (packages/webapp/webapp_server.js:400)
at packages/webapp/webapp_server.js:651
I get the above error and i have no idea what it means . I don't even know where the url comes from. But it makes my website work no more.