reason-native icon indicating copy to clipboard operation
reason-native copied to clipboard

refmterr cannot be npm installed

Open jozanza opened this issue 6 years ago • 5 comments

I tried installing nearly every version, and none of them work.

npm i -g refmterr yields the output such as this:

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/<MISSING_PACKAGE> - Not found
npm ERR! 404 
npm ERR! 404  '<MISSING_PACKAGE>' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404 It was specified as a dependency of 'refmterr'
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

<MISSING_PACKAGE> is not deterministic but seems to be any of the following:

  • @opam/dune@*
  • @opam/atdgen@*
  • @opam/re@*
  • @opam/jbuilder@* (super old versions)

I'd really love to install refmterr as a standalone binary just like how I have refmt. But currently, it seems impossible to use it outside of an esy project 😢

Can you offer any advice/clarification/workarounds?

jozanza avatar Nov 27 '19 19:11 jozanza

Hi @jozanza, an immediate workaround would be to install using (esy)[https://esy.sh/] (you can still use your package.json and the commands are all essentially the same. Basically the errors you are getting are for packages that live in the opam registry (esy knows how to download packages from ocaml and npm/yarn do not).

@jordwalke probably has a sense of whether or not this is a feature or a bug. Nothing has changed recently, but I could maybe see there being value in having some kind of executable we could readily distribute

bandersongit avatar Nov 27 '19 20:11 bandersongit

Thanks for the response @bandersongit!

I'm happily using plain old dune + opam in my project, so unfortunately, switching over to esy would be a bit of a hassle. I'll hold out for that executable 🤞😄

This is a bit off-topic but also somewhat related: Upon further inspection, I'm realizing actually none of the @reason-native libs seem to be available on opam. So unfortunately, I can't use awesome libs like console and rely either. It'd be super cool if y'all could share these libraries in a way that doesn't force folks to adopt a particular package manager 🙏.

jozanza avatar Nov 28 '19 07:11 jozanza

Upon further inspection, I'm realizing actually none of the @reason-native libs seem to be available on opam. So unfortunately, I can't use awesome libs like console and rely either. It'd be super cool if y'all could share these libraries in a way that doesn't force folks to adopt a particular package manager 🙏.

I think that is something we actively want to do. @jordwalke actually did the work to create properly formed opam files for all of our libraries, so I think we are probably pretty close.

bandersongit avatar Nov 28 '19 13:11 bandersongit

Very excited to hear that! I’ll keep my eyes on this issue for any updates. Thanks!

jozanza avatar Nov 28 '19 21:11 jozanza

Small update 🎉

While these packages are not yet published on opam, as @bandersongit pointed out, they do have properly formed opam files. So it is possible to install and use them without esy via opam pin:

REASON_NATIVE_URL=https://github.com/facebookexperimental/reason-native.git
opam pin console $(REASON_NATIVE_URL)\#master --yes
opam pin pastel $(REASON_NATIVE_URL)\#master --yes
opam pin refmterr $(REASON_NATIVE_URL)\#master --yes
opam pin file-context-printer $(REASON_NATIVE_URL)\#master --yes
opam pin rely $(REASON_NATIVE_URL)\#master --yes

Of course, it would still be much nicer if they were published on opam 😉

Note: It also looks like there's a pin-depends stanza for .opam files, and it seems possible to use it in conjunction with the regular depends stanza to specify a pinned dependency. But I didn't really explore this option.

jozanza avatar Dec 02 '19 22:12 jozanza