Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7883591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:34:23+00:00 2026-06-03T04:34:23+00:00

I’m trying to learn the q library with node. $ node -v // ->

  • 0

I’m trying to learn the “q” library with node.

$ node -v // -> v0.6.6

I’m using the latest q.js from https://github.com/kriskowal/q/blob/master/q.js now. I copied the code into a q.js file which is the sibling of my testq.js file.

The code of testq.js is:

function step1(callback) { console.log("step1"); callback("abc"); };

var Q = require("./q");

Q.fcall(step1).end();

When I run it:

node testq.js

It reports:

E:\WORKSPACE_NODE\TestNodeJs\q>node testq.js
step1

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
          ^
TypeError: undefined is not a function
    at step1 (E:\WORKSPACE_NODE\TestNodeJs\q\testq.js:1:112)
    at makePromise.<anonymous> (E:\WORKSPACE_NODE\TestNodeJs\q\q.js:541:27)
    at makePromise.promiseSend (E:\WORKSPACE_NODE\TestNodeJs\q\q.js:325:41)
    at Array.0 (E:\WORKSPACE_NODE\TestNodeJs\q\q.js:787:28)
    at EventEmitter._tickCallback (node.js:192:40)

I installed v8 debugger plugin for eclipse, debug it line by line. Unfortunately, I can’t find the error start.

I’m a newbie to nodejs, please help me with debugging. E.g. what tool should I use? Or any other helpful method I should try?


UPDATE

Per Hogan’s answer, the code:

function step1(callback) { console.log("step1"); };

var Q = require("./q");

Q.fcall(step1).end();

can be run successfully without any error.

But when I try:

function step1(callback) { console.log("step1"); };

var Q = require("./q");

Q.fcall(step1)
.then(function(v) {
    console.log("finished: " +v);
}, function(err){
    console.log(err);
})
.end();

It prints:

E:\WORKSPACE_NODE\TestNodeJs\q>node testq.js
step1
finished: undefined

I still want a demo that step1 will pass something to the function(v) {console.log("finished: " +v);}, where v is not an undefined.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:34:25+00:00Added an answer on June 3, 2026 at 4:34 am

    Make your step1 look like this(modified as the last version):

     function step1() { console.log("step1"); return "abc" };
    

    Then you will be happy.


    Looking at the Q documentation I believe you want ‘Q.node(…) or Q.ncall(…) or Q.fcall(…)

    I’d read about Q some more, or if you describe what you want to do I might be able to help.


    step1 takes a parameter — a function.

    But you don’t define that when you call it so callback("abc"); is undefined.

    Maybe it is clearer when you get rid of all the stuff that does not matter:

     function step1(callback) { console.log("step1"); callback("abc"); };
    
     var Q = require("q");
    
     Q.call(step1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.