I wanted to play a bit with Reason but I ran into some issues while installing the reason-cli
on my MacOs as described in the global installation page.
My setup: MacOs 10.13.2, npm 5.6 and node 9.2.0.
The error I got running npm install -g https://github.com/reasonml/reason-cli/archive/3.0.4-bin-darwin.tar.gz
was:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! reason-cli@3.0.4 postinstall: `./bin/esyBuildRelease bin install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reason-cli@3.0.4 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.¶
Reported here and here. It seems that the issue is related to some bug with npm 5 messing with file permissions.
It could be that passing --unsafe-perm
to the npm install could fix the issue as well but I didn't try it as I had already spent 2 hours trying to fix the issue. This is what I did:
I ran npm install
with the --ignore-scripts
flag to not execute the faulty post-install script:
npm install -g --ignore-scripts https://github.com/reasonml/reason-cli/archive/3.0.4-bin-darwin.tar.gz
Inside the installation dir .nvm/versions/node/v9.2.0/lib/node_modules/reason-cli/
I had to change the file ownership and group because they looked wrong:
ll ~/.nvm/versions/node/v9.2.0/lib/node_modules/reason-cli/r/build-eject/bin/esyImportBuild
-rwx------ 1 653775386 1876110778
sudo chown -R $USER r
Then I executed the postinstall script with sudo
sudo ./bin/esyBuildRelease bin install
and everything worked. I hope it helps anyone else facing the same issue.
Happy Coding!