fdopen / opam-repository-mingw

windows package repository for OPAM (mingw and msvc)
https://fdopen.github.io/opam-repository-mingw/
Creative Commons Zero v1.0 Universal
96 stars 33 forks source link

Can't install any packages after install. #62

Closed marryton007 closed 4 years ago

marryton007 commented 5 years ago

My environment: Win10 home edition, x64. I have downloaded the 64bit Graphical Installer from this page. The progress of install is fine, but when I open the Ocaml64 terminal and run opam install merlin. I got follow:

$ opam install merlin
[ERROR] No switch is currently set. Please use 'opam switch' to set or install a switch

I try to run opam init, but it seems has not install ocaml compiler

$ opam init

<><> Required setup - please read <><><><><><><><><><><><><><><><><><><><><><><>

  In normal operation, opam only alters files within ~/.opam.

  However, to best integrate with your system, some environment variables
  should be set. If you allow it to, this initialisation step will update
  your bash configuration by adding the following line to C:/Users/marryton007/.bash_profile:

    test -r C:/Users/marryton007/.opam/opam-init/init.sh && . C:/Users/marryton007/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true

  Otherwise, every time you want to access your opam installation, you will
  need to run:

    eval $(opam env)

  You can always re-run this setup with 'opam init' later.

Do you want opam to modify C:/Users/marryton007/.bash_profile? [N/y/f]
(default is 'no', use 'f' to choose a different file)
A hook can be added to opam's init scripts to ensure that the shell remains in sync with the opam environment when they are loaded. Set that up? [y/N]
fdopen commented 5 years ago

What's the output of cat /etc/passwd and env. Does it differ, if you start cygwin from the windows explorer (e.g. C:\OCaml64\Cygwin.bat).

marryton007 commented 5 years ago

I'v installed ocaml into D:\programe\ocaml\OCaml64, run D:\programe\ocaml\OCaml64\Cygwin.bat

output of cat /etc/passwd

$ cat /etc/passwd
cat: /etc/passwd: No such file or directory

output of env env.log

fdopen commented 5 years ago

Do the directories D:\programe\ocaml\OCaml64\home\marryton007 and D:\programe\ocaml\OCaml64\home\marryton007\.opam exist?

If yes, try to generate the /etc/passwd manually (normally the installer does it):

mkpasswd -p /home -c > /etc/passwd
cat /etc/passwd # check output

Then close the terminal and start a new one. echo $HOME should now be /home/marryton007 and opam should be initialized.

Otherwise you have to call opam init with the proper arguments:

opam init default "https://github.com/fdopen/opam-repository-mingw.git#opam2" -c "ocaml-variants.4.08.1c"
marryton007 commented 4 years ago

I can't find the directory D:\programe\ocaml\OCaml64\home\marryton007 and I checked the environments of my system. I found the HOME variable. After delete it and re-run the installer program. It works fine.

I have forgot why and when adding the HOME environment variable.