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

  • Home
  • SEARCH
  • 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 6759795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:59:33+00:00 2026-05-26T13:59:33+00:00

I’m trying to get the nodeunit module working within a coffeescript project but can’t

  • 0

I’m trying to get the nodeunit module working within a coffeescript project but can’t seem to get even a basic test to run.
Here’s my example Coffeescript
require ‘nodeunit’

test = true
test2 = false

exports.testSomething = (test) ->
  test.expect(1)
  test.ok(true, "this should pass")
  test.done()

exports.testSomethingElse = (test2) ->
  test2.expect(1)
  test2.ok(false, "this should fail")
  test2.done()

Unfortunately, when I run ‘$ nodeunit example.coffee’ I get the error output:

example.coffee:4 exports.testSomething = (test) ->
^

module.js:296
throw err;
^ SyntaxError: Unexpected token >
at Module._compile (module.js:397:25)
at Object..js (module.js:408:10)
at Module.load (module.js:334:31)
at Function._load (module.js:293:12)
at require (module.js:346:19)
at /usr/local/lib/node/nodeunit/lib/nodeunit.js:75:37
at /usr/local/lib/node/nodeunit/deps/async.js:508:13
at /usr/local/lib/node/nodeunit/deps/async.js:118:13
at /usr/local/lib/node/nodeunit/deps/async.js:134:9
at /usr/local/lib/node/nodeunit/deps/async.js:507:9

Can anyone help me just get a simplified test up and running in Coffeescript using Node.js?

Thanks in advance

  • 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-05-26T13:59:34+00:00Added an answer on May 26, 2026 at 1:59 pm

    Your example runs fine for me. It could be that you’re using an old version of nodeunit, before it had CoffeeScript support; try

    npm install -g nodeunit
    

    to update to the latest version.

    If that fails, then I suspect that it’s a path issue, so that when nodeunit tries to do require 'coffee-script', it fails.

    First do

    npm install -g coffee-script
    

    and take note of the last line of the output, which should look something like

    coffee-script@1.1.2 /usr/local/lib/node_modules/coffee-script
    

    Now run

    echo $NODE_PATH
    

    which in my case is /usr/local/lib/node_modules. You need to set NODE_PATH to the parent directory of the coffee-script directory that npm created, by adding a line like

    export NODE_PATH=/usr/local/lib/node_modules
    

    to ~/.profile or ~/.bashrc or whatever else it is your shell runs when it starts, and restart your shell. Then whenever you do require 'coffee-script' from any Node app on your machine, it’ll find the CoffeeScript library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
I am trying to loop through a bunch of documents I have to put
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

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.