SitePoint Sponsor

User Tag List

Results 1 to 14 of 14

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Node.js - nodeunit or Make and node-jquery compatibility issue

    When I try to run a unit test I get following error:

    C:\users\thomas\chap02\node_modules\jquery\lib\node-jquery.js:10
    window.XMLHttpRequest.prototype.withCredentials = false;
    ^
    TypeError: Cannot read property 'prototype' of undefined
    at create (C:\users\thomas\chap02\node_modules\jquery\lib\node-jquery.js:10:26)
    at C:\users\thomas\chap02\node_modules\jquery\lib\node-jquery.js:9435:18
    at Object.<anonymous>
    (C:\users\thomas\chap02\node_modules\jquery\lib\node-jquery.js:9437:2)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (C:\users\thomas\chap02\lib\exchange.js:3:9)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (C:\users\thomas\chap02\test\exchange.test.js:7:14)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at C:\users\thomas\chap02\node_modules\mocha\bin\_mocha:313:27
    at Array.forEach (native)
    at load (C:\users\thomas\chap02\node_modules\mocha\bin\_mocha:310:9)
    at Object.<anonymous>
    (C:\users\thomas\chap02\node_modules\mocha\bin\_mocha:301:1)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)
    Makefile:2: recipe for target `test' failed
    make: *** [test] Error 1

    I am developing on windows 7 with Cygwin so I have a shell in some flavor.

    Do you know a way to keep modules code out of the test scope - no need to test module code (already tested)?

    Or do you know how to make this work?

    Thanks ; )

  2. #2
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    I've seen some other folks come across this issue as well... I didn't seem to have it until I downgraded to Node 0.8.14 yesterday, in Node 0.9.2 it wasn't doing this to me.

    Try reinstalling the jquery module and see how you go.

    Run this in the chapter's directory:
    Code:
    npm install jquery
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }

  3. #3
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Decided to install a visualbox on my windows machine and installed ubunto. Than I had the issue again when i installed jquery I noticed i needed make g++ - C++ build essential. I installed it and reinstalled jquery and then the make test also worked. However i also installed nvm and use node0.9.2. So now make test works - and all tests evalutes to green ; ) Thanks saved me a lot time.

  4. #4
    SitePoint Author
    Join Date
    Nov 2012
    Posts
    48
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    thomasoriis, see my answer #10 here:

    http://www.sitepoint.com/forums/show...ain)&p=5227649

  5. #5
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Don - and thank you for your book. Yes that would solve the problem - however I am also developing an other application that needs more of jquery. But the link can help others I hope. Btw maybe you should point to sitepoint forums from the books site. I had to write to books@sitepoint.com and was directed to this forum. I would have saved me a lot of pain and efford : )

  6. #6
    SitePoint Member
    Join Date
    Dec 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don, could you repost that link above? It does not appear to be working

    Stuck in chapter 2 at the moment.

  7. #7
    SitePoint Author
    Join Date
    Nov 2012
    Posts
    48
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The problem is related to the following bug in node-jquery:

    https://github.com/coolaj86/node-jquery/issues/35

    The work around is to remove jQuery. It was mainly there as an illustration of what's possible it's not an essential part of the project. The cloning function can be replaced as follows:

    https://gist.github.com/4167847

    This will also require a new package.json:

    https://gist.github.com/4167853

    Please let me know if there are still further issues

  8. #8
    SitePoint Member
    Join Date
    Dec 2010
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don, thank you for posting the modified code.

    I ended up coding a cloneExchangeData() function, which was actually a good opportunity to learn more about Javascript. Hopefully Brent or someone can post after using the modified code.

    Onward and upward!

  9. #9
    SitePoint Member
    Join Date
    Jan 2009
    Location
    Australia
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks - worked like a charm

    Quote Originally Posted by Don Nguyen View Post
    The problem is related to the following bug in node-jquery:

    https://github.com/coolaj86/node-jquery/issues/35

    The work around is to remove jQuery. It was mainly there as an illustration of what's possible it's not an essential part of the project. The cloning function can be replaced as follows:

    https://gist.github.com/4167847

    This will also require a new package.json:

    https://gist.github.com/4167853

    Please let me know if there are still further issues

  10. #10
    SitePoint Member
    Join Date
    Mar 2013
    Location
    Galway, Ireland
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Don Nguyen View Post
    The problem is related to the following bug in node-jquery:

    https://github.com/coolaj86/node-jquery/issues/35

    The work around is to remove jQuery. It was mainly there as an illustration of what's possible it's not an essential part of the project. The cloning function can be replaced as follows:

    https://gist.github.com/4167847

    This will also require a new package.json:

    https://gist.github.com/4167853

    Please let me know if there are still further issues
    cheers for the workaround.

    also needs:
    npm install clone

  11. #11
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Don, it's fantastic that you're such an active member our community. Thank you for posting the workaround.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •