BuckleScript

BuckleScript

  • Docs
  • Try
  • API
  • Community
  • Blog
  • Languages iconEnglish
    • 日本語
    • Español
    • Français
    • 한국어
    • Português (Brasil)
    • Русский
    • 中文
    • 繁體中文
    • Help Translate
  • GitHub

›Intro

Intro

  • What & Why
  • Installation
  • New Project
  • Try
  • Concepts Overview
  • Upgrade Guide to v7

Interop

  • Overview
  • Cheatsheet
  • Embed Raw JavaScript
  • Common Data Types
  • Intro to External
  • Bind to Global Values
  • Null, Undefined & Option
  • Object
  • Object 2
  • Class
  • Function
  • Property access
  • Return value wrapping
  • Import & Export
  • Regular Expression
  • Exceptions
  • JSON
  • Pipe First
  • Generate Converters & Helpers
  • Better Data Structures Printing (Debug Mode)
  • NodeJS Special Variables
  • Miscellaneous
  • Browser Support & Polyfills

Build System

  • Overview
  • Configuration
  • Automatic Interface Generation
  • Interop with Other Build System
  • Performance
  • Advanced

Standard Library

  • Overview

Advanced

  • Conditional Compilation
  • Extended Compiler Options
  • Use Existing OCaml Libraries
  • Difference from Native OCaml
  • Compiler Architecture & Principles
  • Comparison to Js_of_ocaml
Edit

Installation

Prerequisite: either NPM (comes with node) or Yarn.

If you'd like to install BuckleScript globally, do:

yarn global add bs-platform

or

npm install -g bs-platform

This gives you a few globally exposed commands you can run, described later. But usually, you'd install the project locally:

yarn add --dev bs-platform
npm install --save-dev bs-platform

The commands that are exposed are:

  • bsb, the build system.
  • bsc, the raw compiler. Usually not used directly.
  • bsrefmt, the included Reason parser & printer.

Alternatives (Power Users)

Install From Source, Through NPM/Yarn

Prerequisite: either npm or yarn, plus the standard C toolchain.

git clone https://github.com/bucklescript/bucklescript
cd bucklescript
npm install

Install From Source, Without NPM/Yarn

See this for details https://github.com/BuckleScript/bucklescript/blob/master/CONTRIBUTING.md#setup

Troubleshooting

spawnSync ENOENT error

If you get an error that looks like Error: spawnSync /node_modules/bs-platform/lib/bsb.exe ENOENT it might be caused if you have npm postinstall scripts disabled. In that case, re-enable scripts with npm config set ignore-scripts false and re-install bs-platform

Permission denied errors

Under some conditions, the global installation of bs-platform will result in npm errors, typically indicating Error: EACCES: permission denied. Here are some methods for resolving this problem.

Manually change npm’s default directory

Changing where NPM stores the package files may help, see the second solution on the docs.npmjs.com site.

Enable the unsafe-perm npm option

While using unsafe-perm does have some drawbacks, it easily resolves the permissions issue. When the changing the default directory does not work, then this may be the next best option.

npm install -g bs-platform --unsafe-perm
Last updated on 4/13/2020
← What & WhyNew Project →
  • Alternatives (Power Users)
    • Install From Source, Through NPM/Yarn
    • Install From Source, Without NPM/Yarn
  • Troubleshooting
    • spawnSync ENOENT error
    • Permission denied errors