Open slogsdon opened 7 years ago
Removing OCaml and related tools from the system seems to allow npm install
to work without issue:
$ brew uninstall opam
Uninstalling /usr/local/Cellar/opam/1.2.2_2... (30 files, 14.9M)
$ brew uninstall ocaml camlp4 ocamlbuild
Uninstalling /usr/local/Cellar/ocaml/4.04.0... (1,730 files, 194.0M)
Uninstalling /usr/local/Cellar/camlp4/4.04+1... (165 files, 143M)
Uninstalling /usr/local/Cellar/ocamlbuild/0.9.3_1... (27 files, 6.9M)
$ brew uninstall --force ocaml camlp4 ocamlbuild
$ brew uninstall opam --force
$ ± rm -rf ~/.opam/
$ cd ..
$ rm -rf HelloReason
$ which opam
opam not found
$ which ocaml
ocaml not found
$ which ocamlbuild
ocamlbuild not found
$ git clone https://github.com/reasonml/ReasonProject HelloReason
$ cd HelloReason
$ npm install
# ... later
> ReasonProject@0.0.1 postinstall /Users/shane.logsdon/Code/reason/HelloReason
> npm run reasonBuild
> ReasonProject@0.0.1 reasonBuild /Users/shane.logsdon/Code/reason/HelloReason
> eval $(dependencyEnv) && nopam && rebuild -I src ./src/Test.native 2>&1 | refmterr
/Users/shane.logsdon/Code/reason/HelloReason/node_modules/ocaml/bin/ocamldep.opt -modules -pp refmt -impl src/Test.re | tee src/Test.re.depends > src/Test.ml.depends
env OCAMLC="ocamlc.opt" /Users/shane.logsdon/code/reason/HelloReason/node_modules/reason/_build/ocamlfind/bin/rec -c -I src -pp refmt -o src/Test.cmo -intf-suffix .rei -impl src/Test.re
env OCAMLOPT="ocamlopt.opt" /Users/shane.logsdon/code/reason/HelloReason/node_modules/reason/_build/ocamlfind/bin/reopt -c -I src -pp refmt -o src/Test.cmx -intf-suffix .rei -impl src/Test.re
env OCAMLOPT="ocamlopt.opt" /Users/shane.logsdon/code/reason/HelloReason/node_modules/reason/_build/ocamlfind/bin/reopt src/Test.cmx -o src/Test.native
✔ Seems fine!
ReasonProject@0.0.1 /Users/shane.logsdon/Code/reason/HelloReason
├─┬ @opam-alpha/merlin@2.5.1
│ └─┬ merlin-actual@2.5.1 (git://github.com/npm-opam/merlin.git#5b236062b3cceff3e653ba47283159cf6895a93b)
│ └─┬ @opam-alpha/yojson@1.3.3
│ └─┬ yojson-actual@1.3.3 (git://github.com/npm-opam/yojson.git#a72727dd8899c53153fd8a7cea06c626d0a71faf)
│ └─┬ @opam-alpha/biniou@1.0.12
│ └─┬ biniou-actual@1.0.12 (git://github.com/npm-opam/biniou.git#198ece6041aa0853bc1637475796840b3daae5a9)
│ └─┬ @opam-alpha/conf-which@1.0.0
│ └── conf-which-actual@1.0.0 (git://github.com/npm-opam/conf-which.git#0b798e035ea41e43744ff28075b15d1a5dc9ac99)
├─┬ @opam-alpha/ocaml@4.2.3
│ └── ocaml@4.2.3 (git+https://github.com/npm-opam/ocaml.git#0bb98be8e5233a02282ed8de0c8965677ddbde33)
├─┬ dependency-env@0.0.1
│ └── resolve@1.2.0
├── fastrealpath@0.1.1
├── nopam@0.1.0
└─┬ reason@1.4.0
├─┬ @opam-alpha/BetterErrors@0.0.1
│ └─┬ BetterErrors-actual@0.0.1 (git://github.com/npm-opam/BetterErrors.git#3a8c29bb67089b4b615ced135f3bd608be0e5aa0)
│ └─┬ @opam-alpha/ANSITerminal@0.7.0
│ └── ANSITerminal-actual@0.7.0 (git://github.com/npm-opam/ANSITerminal.git#787c809f7b3e0d6445b803805f81a74a2af7b503)
├─┬ @opam-alpha/easy-format@1.2.0
│ └── easy-format-actual@1.2.0 (git://github.com/npm-opam/easy-format.git#9a61ee2ca3cff40b50a36dc66dcb7761d096a451)
├─┬ @opam-alpha/menhir@20160825.0.0
│ └─┬ menhir-actual@20160825.0.0 (git://github.com/npm-opam/menhir.git#8d6905e8eeb4bedcec501a14fdc7a7d950f85874)
│ └── @opam-alpha/ocamlbuild@0.9.2
├─┬ @opam-alpha/merlin-extend@0.3.0
│ └─┬ merlin-extend-actual@0.3.0 (git://github.com/npm-opam/merlin-extend.git#8d01d124db27f46a27e04f25d0e1c54bab0d0f48)
│ └─┬ @opam-alpha/cppo@1.4.1
│ └── cppo-actual@1.4.1 (git://github.com/npm-opam/cppo.git#f93baf17d8099c5866df939264ddddb6457aa7d2)
├─┬ @opam-alpha/ocamlfind@1.6.2
│ └─┬ ocamlfind-actual@1.6.2 (git+https://github.com/npm-opam/ocamlfind.git#f6ea48c7628210d477ead863d32feba2357b9afe)
│ └─┬ @opam-alpha/conf-m4@4.1.0
│ └── conf-m4-actual@4.1.0 (git://github.com/npm-opam/conf-m4.git#75e353ae7ae97a988319ddb0e97ecfa25bce4739)
├─┬ @opam-alpha/re@1.7.1
│ └── re-actual@1.7.1 (git://github.com/npm-opam/re.git#9da39424a8a4a12a768f90b1e5cc4401102b6834)
├── dependency-env@0.1.1 (git+https://github.com/reasonml/dependency-env.git#94c75aff3a71587afb570d89bcf2eef7996bb67f)
├── nopam@0.1.0 (git+https://github.com/reasonml/nopam.git#7cd19f068ac9aaf75010cd6961f7c65c779a1d4a)
├─┬ opam-installer-bin@0.0.0 (git+https://github.com/yunxing/opam-installer-bin.git#689ede681217f76fb2f82a9f4528e192a5b543ba)
│ ├── dependency-env@0.1.1 (git+https://github.com/npm-ml/dependency-env.git#94c75aff3a71587afb570d89bcf2eef7996bb67f)
│ └── nopam@0.1.0 (git+https://github.com/yunxing/nopam.git#7cd19f068ac9aaf75010cd6961f7c65c779a1d4a)
├── substs@0.0.1 (git+https://github.com/yunxing/substs.git#fd480dcdb4aed3fa9128fd819a546e3a7770040f)
└─┬ utop-bin@1.19.2 (git+https://github.com/reasonml/utop-bin.git#5e9e322c1f264c0d9e8abb9f85e5472de1c8147d)
├── camomile-bin@0.8.5 (git+https://github.com/reasonml/camomile-bin.git#08f5d6115b76d46897af47b9ee8e70a55973b40f)
├─┬ lambda-term-bin@1.10.0 (git+https://github.com/reasonml/lambda-term-bin.git#72137b68f22af1fd2d1e52afbb02ff45b494908a)
│ └── zed-bin@1.4.0 (git+https://github.com/reasonml/zed-bin.git#7d2f0677a4a73c1b51ecbf05589e1f7b5bd76705)
├── lwt-bin@2.5.2 (git+https://github.com/reasonml/lwt-bin.git#96859b56091d3b46d3c36e80522a137bb768fee5)
└── react-bin@1.2.2 (git+https://github.com/reasonml/react-bin.git#b9868712a9e76af9de52e726912bdd99f9a66e87)
Attempting again from scratch with 4.04.0 sees the exact same result as before:
$ brew install opam
==> Installing dependencies for opam: ocaml, ocamlbuild, camlp4
==> Installing opam dependency: ocaml
==> Downloading https://homebrew.bintray.com/bottles/ocaml-4.04.0.el_capitan.bottle.tar.gz
Already downloaded: /Users/shane.logsdon/Library/Caches/Homebrew/ocaml-4.04.0.el_capitan.bottle.tar.gz
==> Pouring ocaml-4.04.0.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/ocaml/4.04.0: 1,730 files, 194.0M
==> Installing opam dependency: ocamlbuild
==> Downloading https://homebrew.bintray.com/bottles/ocamlbuild-0.9.3_1.el_capitan.bottle.tar.gz
Already downloaded: /Users/shane.logsdon/Library/Caches/Homebrew/ocamlbuild-0.9.3_1.el_capitan.bottle.tar.gz
==> Pouring ocamlbuild-0.9.3_1.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/ocamlbuild/0.9.3_1: 27 files, 6.9M
==> Installing opam dependency: camlp4
==> Downloading https://homebrew.bintray.com/bottles/camlp4-4.04+1.el_capitan.bottle.tar.gz
Already downloaded: /Users/shane.logsdon/Library/Caches/Homebrew/camlp4-4.04+1.el_capitan.bottle.tar.gz
==> Pouring camlp4-4.04+1.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/camlp4/4.04+1: 165 files, 143M
==> Installing opam
==> Downloading https://homebrew.bintray.com/bottles/opam-1.2.2_2.el_capitan.bottle.tar.gz
Already downloaded: /Users/shane.logsdon/Library/Caches/Homebrew/opam-1.2.2_2.el_capitan.bottle.tar.gz
==> Pouring opam-1.2.2_2.el_capitan.bottle.tar.gz
==> Caveats
OPAM uses ~/.opam by default for its package database, so you need to
initialize it first by running (as a normal user):
$ opam init
Run the following to initialize your environment variables:
$ eval `opam config env`
To export the needed variables every time, add them to your dotfiles.
* On Bash, add them to `~/.bash_profile`.
* On Zsh, add them to `~/.zprofile` or `~/.zshrc` instead.
Documentation and tutorials are available at https://opam.ocaml.org, or
via "man opam" and "opam --help".
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completion has been installed to:
/usr/local/share/zsh/site-functions
==> Summary
🍺 /usr/local/Cellar/opam/1.2.2_2: 30 files, 14.9M
$ opam init
Checking for available remotes: rsync and local, git, mercurial.
- you won't be able to use darcs repositories unless you install the darcs command on your system.
=-=- Fetching repository information =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 🐫
[default] synchronized from https://opam.ocaml.org
=-=- Gathering sources =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 🐫
=-=- Processing actions -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 🐫
∗ installed base-bigarray.base
∗ installed base-threads.base
∗ installed base-unix.base
Done.
In normal operation, OPAM only alters files within ~/.opam.
During this initialisation, you can allow OPAM to add information to two
other files for best results. You can also make these additions manually
if you wish.
If you agree, OPAM will modify:
- ~/.zshrc (or a file you specify) to set the right environment
variables and to load the auto-completion scripts for your shell (zsh)
on startup. Specifically, it checks for and appends the following line:
. /Users/shane.logsdon/.opam/opam-init/init.zsh > /dev/null 2> /dev/null || true
- ~/.ocamlinit to ensure that non-system installations of `ocamlfind`
(i.e. those installed by OPAM) will work correctly when running the
OCaml toplevel. It does this by adding $OCAML_TOPLEVEL_PATH to the list
of include directories.
If you choose to not configure your system now, you can either configure
OPAM manually (instructions will be displayed) or launch the automatic setup
later by running:
opam config setup -a
Do you want OPAM to modify ~/.zshrc and ~/.ocamlinit?
(default is 'no', use 'f' to name a file other than ~/.zshrc)
[N/y/f] y
User configuration:
~/.ocamlinit is already up-to-date.
~/.zshrc is already configured for another OPAM root.
Global configuration:
Updating ~/.opam/opam-init/init.sh
Updating ~/.opam/opam-init/init.zsh
Updating ~/.opam/opam-init/init.csh
Updating ~/.opam/opam-init/init.fish
# To setup the new switch in the current shell, you need to run:
eval `opam config env`
$ eval `opam config env`
$ cd ..
$ rm -rf HelloReason
$ git clone https://github.com/reasonml/ReasonProject HelloReason
$ cd HelloReason
$ npm install
Using opam switch 4.02.3
also corrects the issue.
Funny enough, installing 4.04.0 through Opam (with opam switch 4.04.0
) works, so the issue seems to be caused by system installed OCaml 4.04.0.
Great repro documentation. esy
and we're looking at making esy
the standard way of building packages. But what can we do in the mean time to prevent this from happening (a quicker fix?)
I would say that updating the README would be a good start, letting users know to opam switch
to a non-system version if they experience issues. Thoughts?
Updated the docs, and we are working on a legit fix to this issue. Thank you for reporting.
+1 Same issue here.
Very close to getting big fix that prevents any global environment from even being perceived by the package install.
Running
npm install
fails when OCaml 4.04.0 is installed globally:Switching to 4.02.3 seems to correct the issue:
I'm checking into the following things but wanted to get this logged beforehand:
Edit: Adding version numbers: