Unable to require anything in CoffeeScript or LiveScript
See original GitHub issueThe 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:
- Created 9 years ago
- Comments:12 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
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 innode_modules
and also globally installed and removed and reinstalled thenode_modules
. gulp@3.9.1 and node@6.6.0.