* Show an appropriate error if the user tries to use --transpile via the CLI and babel-core isn’t installed * Update documentation around global/local * Fix #4713: Use Babel’s built-in `filename` option to let Babel search for its options, rather than us doing so * Improve transpilation docs * Colons are good * Docs cleanup * Rewrite transpilation docs * Better identifier for compiled scripts that didn’t come from files; better resolving of paths
1.4 KiB
Installation
The command-line version of coffee
is available as a Node.js utility, requiring Node 6 or later. The [core compiler](/v<%= majorVersion %>/browser-compiler/coffeescript.js) however, does not depend on Node, and can be run in any JavaScript environment, or in the browser (see Try CoffeeScript).
To install, first make sure you have a working copy of the latest stable version of Node.js. You can then install CoffeeScript globally with npm:
npm install --global coffeescript
This will make the coffee
and cake
commands available globally.
If you are using CoffeeScript in a project, you should install it locally for that project so that the version of CoffeeScript is tracked as one of your project’s dependencies. Within that project’s folder:
npm install --save-dev coffeescript
The coffee
and cake
commands will first look in the current folder to see if CoffeeScript is installed locally, and use that version if so. This allows different versions of CoffeeScript to be installed globally and locally.
If you plan to use the --transpile
option (see Transpilation) you will need to also install babel-core
either globally or locally, depending on whether you are running a globally or locally installed version of CoffeeScript.