Reason: Cannot install reason on mac os x

Created on 31 Mar 2018  ยท  7Comments  ยท  Source: reasonml/reason

Hi,
I cannot install reason on a fresh mac osx (Sierra 10.13.3)

  1. Installing node via the official installer 'node-v9.10.1.pkg'

During the installation I have to give the admin password for:

Node.js v9.10.1 to /usr/local/bin/node
npm v5.6.0 to /usr/local/bin/npm

That worked, node is installed, now lets proceed with reason.

The installation according to the description on the web page fails.

$ npm install -g bs-platform
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

According to the last line on the error message I go as root,

sudo npm install -g bs-platform
Password:
/usr/local/bin/bsb -> /usr/local/lib/node_modules/bs-platform/lib/bsb
/usr/local/bin/bsc -> /usr/local/lib/node_modules/bs-platform/lib/bsc
/usr/local/bin/bsrefmt -> /usr/local/lib/node_modules/bs-platform/lib/bsrefmt

> [email protected] postinstall /usr/local/lib/node_modules/bs-platform
> node scripts/install.js

checkoutput: The OCaml compiler, version BuckleScript 2.2.3 (Using OCaml4.02.3+BS )
Standard library directory: /usr/local/lib/node_modules/bs-platform/lib/ocaml

/usr/local/lib/node_modules/bs-platform/lib/bsb.darwin -----> /usr/local/lib/node_modules/bs-platform/lib/bsb.exe
No working prebuilt compiler
No matched compiler found, may re-try
Build a local version of OCaml compiler, it may take a couple of minutes
touch: s.h: Permission denied
touch: m.h: Permission denied
touch: Makefile: Permission denied
./configure: line 200: Makefile: Permission denied
./configure: line 204: Makefile: Permission denied
./configure: line 206: Makefile: Permission denied
./configure: line 211: Makefile: Permission denied
./configure: line 215: Makefile: Permission denied
./configure: line 217: Makefile: Permission denied
./configure: line 221: Makefile: Permission denied
mkdir: /usr/local/lib/node_modules/bs-platform/cg67187-8163: Permission denied
mkdir: /usr/local/lib/node_modules/bs-platform/cg-67187: Permission denied
config.guess: cannot create a temporary directory in /usr/local/lib/node_modules/bs-platform
[ERROR!] Cannot guess host type. You must specify one with the -host option.

touch: s.h: Permission denied
touch: m.h: Permission denied
touch: Makefile: Permission denied
./configure: line 200: Makefile: Permission denied
./configure: line 204: Makefile: Permission denied
./configure: line 206: Makefile: Permission denied
./configure: line 211: Makefile: Permission denied
./configure: line 215: Makefile: Permission denied
./configure: line 217: Makefile: Permission denied
./configure: line 221: Makefile: Permission denied
mkdir: /usr/local/lib/node_modules/bs-platform/cg67187-8163: Permission denied
mkdir: /usr/local/lib/node_modules/bs-platform/cg-67187: Permission denied
config.guess: cannot create a temporary directory in /usr/local/lib/node_modules/bs-platform

Building a local version of the OCaml compiler failed, check the output above for more information. A possible problem is that you don't have a compiler installed.
/usr/local/lib/node_modules/bs-platform/scripts/install.js:111
            throw e;
            ^

Error: Command failed: /usr/local/lib/node_modules/bs-platform/scripts/buildocaml.sh
touch: s.h: Permission denied
touch: m.h: Permission denied
touch: Makefile: Permission denied
./configure: line 200: Makefile: Permission denied
./configure: line 204: Makefile: Permission denied
./configure: line 206: Makefile: Permission denied
./configure: line 211: Makefile: Permission denied
./configure: line 215: Makefile: Permission denied
./configure: line 217: Makefile: Permission denied
./configure: line 221: Makefile: Permission denied
mkdir: /usr/local/lib/node_modules/bs-platform/cg67187-8163: Permission denied
mkdir: /usr/local/lib/node_modules/bs-platform/cg-67187: Permission denied
config.guess: cannot create a temporary directory in /usr/local/lib/node_modules/bs-platform

    at checkExecSyncError (child_process.js:575:11)
    at Object.execFileSync (child_process.js:593:13)
    at tryToProvideOCamlCompiler (/usr/local/lib/node_modules/bs-platform/scripts/install.js:106:27)
    at non_windows_npm_release (/usr/local/lib/node_modules/bs-platform/scripts/install.js:156:9)
    at Object.<anonymous> (/usr/local/lib/node_modules/bs-platform/scripts/install.js:179:5)
    at Module._compile (module.js:649:30)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


   โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
   โ”‚                                     โ”‚
   โ”‚   Update available 5.6.0 โ†’ 5.8.0    โ”‚
   โ”‚     Run npm i -g npm to update      โ”‚
   โ”‚                                     โ”‚
   โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ


npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/bkb/.npm/_logs/2018-03-31T20_19_01_997Z-debug.log

Any ideas?

Thanks

Most helpful comment

Thanks for the link.

solution #2 worked for me. For future reference here is what I did (taken for the link : https://docs.npmjs.com/getting-started/fixing-npm-permissions)

Make a directory for global installations:

mkdir ~/.npm-global

Configure npm to use the new directory path:

npm config set prefix '~/.npm-global'

Open or create a ~/.profile file and add this line:

export PATH=~/.npm-global/bin:$PATH

Back on the command line, update your system variables:

source ~/.profile

And then finally:

npm install -g bs-platform

All 7 comments

Hey @srctxt, thanks for the detailed logs!
This is an npm + osx situation, check this link for instructions on why this happens and how to solve it: https://docs.npmjs.com/getting-started/fixing-npm-permissions.
I'd recommend solution #2 because node version manager can cause other problems.

Thanks for the link.

solution #2 worked for me. For future reference here is what I did (taken for the link : https://docs.npmjs.com/getting-started/fixing-npm-permissions)

Make a directory for global installations:

mkdir ~/.npm-global

Configure npm to use the new directory path:

npm config set prefix '~/.npm-global'

Open or create a ~/.profile file and add this line:

export PATH=~/.npm-global/bin:$PATH

Back on the command line, update your system variables:

source ~/.profile

And then finally:

npm install -g bs-platform

I had the same issue. After the above recipe BS installed successfully, but for anything I'm trying to build now I consistently get "Unbound module Pervasives" (even after clean bsc -init x). Searched and tried various things but gave up after an hour. Hints would be welcome. ;)

@rossberg Have you tried install bs-platform locally to a project and calling it locally? ./node_modules/.bin/bsb -make-world?

$ sudo npm install -g bs-platform

This works for me:

sudo chown -R $(whoami) /usr/local/var/homebrew

sudo chown -R $USER /usr/local

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chenglou picture chenglou  ยท  3Comments

jberdine picture jberdine  ยท  3Comments

kyldvs picture kyldvs  ยท  3Comments

rickyvetter picture rickyvetter  ยท  4Comments

braibant picture braibant  ยท  4Comments