question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to require anything in CoffeeScript or LiveScript

See original GitHub issue

The require functionality seems completely broken as far as I can tell with at least these two languages, and possibly more. Here’s the error screens I’m getting:

CoffeeScript

[23:20:01] Failed to load external module coffee-script/register

/home/{user}/dev-projects/js/sandbox/gulpfile.coffee:1
function (exports, require, module, __filename, __dirname) { fs = require 'fs'
                                                                          ^^^^
SyntaxError: Unexpected string
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Liftoff.handleArguments (/usr/lib/node_modules/gulp/bin/gulp.js:108:3)
    at Liftoff.launch (/usr/lib/node_modules/gulp/node_modules/liftoff/index.js:140:6)
    at Object.<anonymous> (/usr/lib/node_modules/gulp/bin/gulp.js:59:5)
    at Module._compile (module.js:456:26)

LiveScript

(function (exports, require, module, __filename, __dirname) { require! {
                                                                     ^
SyntaxError: Unexpected token !
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Liftoff.handleArguments (/usr/lib/node_modules/gulp/bin/gulp.js:108:3)
    at Liftoff.launch (/usr/lib/node_modules/gulp/node_modules/liftoff/index.js:140:6)
    at Object.<anonymous> (/usr/lib/node_modules/gulp/bin/gulp.js:59:5)
    at Module._compile (module.js:456:26)

JS does not have this issue, but it seems like a bug that both CoffeeScript and LiveScript should fail in exactly the same spot (namely the beginning require phase).

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
yocontracommented, Aug 25, 2014

Your log:

[23:20:01] Failed to load external module coffee-script/register

You need to install coffee-script before you can use coffee-script. npm install coffee-script

0reactions
artelsecommented, Oct 29, 2016

Sorry about reopening here, but I got the same error: Requiring external module coffee-script/register. I tried above suggestions, but no dice. Coffee-script is local in node_modules and also globally installed and removed and reinstalled the node_modules. gulp@3.9.1 and node@6.6.0.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LiveScript - a language which compiles to JavaScript
LiveScript is a language which compiles to JavaScript. It has a straightforward mapping to JavaScript and allows you to write expressive code devoid...
Read more >
Livescript. require! and execute - Stack Overflow
You can't with require ! , I would just use the original require. foo = require('foo')!.
Read more >
CoffeeScript
The command-line version of coffee is available as a Node.js utility, requiring Node 6 or later. The core compiler however, does not depend...
Read more >
Why CoffeeScript Isn't the Answer - Hacker News
Also, there's no such thing as a global in CoffeeScript (unless you ... In JavaScript, you don't need to worry about that because...
Read more >
Learn LiveScript in Y Minutes
Just like its CoffeeScript cousin, LiveScript uses number symbols for # single-line ... 10 0.4 # Note that the leading `0` is required...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found