jescalan / roots

a toolkit for rapid advanced front-end development
http://roots.netlify.com/
Other
1.45k stars 132 forks source link

Roots JS-API Use Coffeescript.register() error #776

Closed iyerrama25 closed 7 years ago

iyerrama25 commented 7 years ago

Hi there, Referring to the following Docs: http://roots.cx/docs/js_api

I copy paste the create new instance of Roots code into 'app.js' and in a package.json adjoining to it, add 'roots' & 'coffee script' as dependencies.

$ npm install
$ node app.js

Am trying to run the app.js and getting the following error:

npm WARN api-project-3 No license field.
progress: dependencies finished installing
/project-path/node_modules/when/lib/decorators/unhandledRejection.js:80
        throw e;
        ^

Error: Use CoffeeScript.register() or require the coffee-script/register module to require .coffee files.
  at Object.(anonymous function).base.(anonymous function) [as .coffee] (/project-path/node_modules/roots/node_modules/coffee-script/lib/coffee-script/coffee-script.js:242:15)
  at Module.load (module.js:456:32)
  at tryModuleLoad (module.js:415:12)
  at Function.Module._load (module.js:407:3)
  at Module.require (module.js:466:17)
  at require (internal/module.js:20:19)
  at Config.load_config (/project-path/node_modules/roots/lib/config.js:117:14)
  at new Config (/project-path/node_modules/roots/lib/config.js:71:19)
  at new Roots (/project-path/node_modules/roots/lib/index.js:43:21)
  at /project-path/node_modules/roots/lib/api/new.js:98:28
  at tryCatchReject (/project-path/node_modules/when/lib/makePromise.js:845:30)
  at runContinuation1 (/project-path/node_modules/when/lib/makePromise.js:804:4)
  at Fulfilled.when (/project-path/node_modules/when/lib/makePromise.js:592:4)
  at Pending.run (/project-path/node_modules/when/lib/makePromise.js:483:13)
  at Scheduler._drain (/project-path/node_modules/when/lib/Scheduler.js:62:19)
  at Scheduler.drain (/project-path/node_modules/when/lib/Scheduler.js:27:9)
  at _combinedTickCallback (internal/process/next_tick.js:67:7)
  at process._tickCallback (internal/process/next_tick.js:98:9)

Not sure how to fix it. Any help would be good.

thanks!

jescalan commented 7 years ago

The error message gives you the solution!

Error: Use CoffeeScript.register() or require the coffee-script/register module to require .coffee files.

If you need to require a coffee file, just run require('coffee-script/register') at the top of the file you are requiring into. Or use a regular js file.