reasonml / reason-cli

Globally installable Reason toolchain.
MIT License
291 stars 23 forks source link

reason-cli npm installation breaks npm outdated #54

Closed develop7 closed 6 years ago

develop7 commented 6 years ago

Repro:

  1. npm install -g <URL-to-reason-cli-binary-release-archive>
  2. Run npm outdated -g

Expected: the second command works as intended Instead: it fails with following output

> npm ou -g
npm ERR! code E404
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/reason-cli
npm ERR! 404 
npm ERR! 404  'reason-cli' 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 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/develop7/.npm/_logs/2017-10-29T08_35_18_470Z-debug.log
jordwalke commented 6 years ago

Adding the PublishToNpm tag as I believe it's the correct solution.

zploskey commented 6 years ago

I no longer see this error on 3.0.1. The npm outdated -g command succeeds.

develop7 commented 6 years ago

@zploskey just have 3.0.1 installed, the issues's still there

zploskey commented 6 years ago

Can you provide some more information your node installation and operating system?

develop7 commented 6 years ago

@zploskey openSUSE Tumbleweed 20171030 x86_64; nodejs v8.8.1; npm v5.4.2

$ cat ~/.npmrc
prefix = /home/develop7/.npm

also the debug log mentioned in npm output 2017-11-01T04_11_49_143Z-debug.log

Hope that helps!

zploskey commented 6 years ago

Thanks for the information. When you upgraded to 3.0.1 did you npm remove -g reason-cli before executing the install command? I understand this may be necessary, and is what I did after initially having this problem on Fedora 26. Does removing and installing it again make any difference?

jordwalke commented 6 years ago

I see the problem on linux with reason-cli 3.0.1. I think it's just going to happen until we push to npm instead of https urls.

zploskey commented 6 years ago

Seems likely. I wonder if I'm not affected because I downloaded first and installed from my local filesystem. It seems like this might be a bug in npm, honestly, but I don't know if they care about supporting installs from anywhere but an npm repository.

jordwalke commented 6 years ago

I do believe it's an npm bug. Though they have added some nice support for git repo deps in the latest release.

csi-adziahel commented 6 years ago

@jordwalke Yep, npm i -g 'git+https://github.com/reasonml/reason-cli.git#3.0.1-bin-darwin' doesn't break npm outdated --global. Although the npm outdated now suggest updating to git version.

I think I'd go with yarn global approach. Being not affected by #33 is an added bonus.

zploskey commented 6 years ago

Using yarn gets you the joy of rebuilding ocaml and bs-platform repeatedly, unfortunately. Maybe for now we should switch the recommendation to use the git tag as you suggest.

andreypopp commented 6 years ago

@zploskey are you seeing this with 3.0.x releases?

zploskey commented 6 years ago

@andreypopp Yes, but only when I installed with a tarball like this:

zach@znbk:~$ node --version
v8.9.0
zach@znbk:~$ npm --version
5.5.1
zach@znbk:~$ npm install -g https://github.com/reasonml/reason-cli/archive/3.0.1-bin-linux.tar.gz
[... installs ok ...]
*** Decompressing artefacts...
*** Relocating artefacts to the final destination...
+ reason-cli@3.0.1
added 1 package in 38.61s
zach@znbk:~$ npm outdated -g
npm ERR! code E404
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/reason-cli
npm ERR! 404 
npm ERR! 404  'reason-cli' 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 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/zach/.npm/_logs/2017-11-01T22_32_43_195Z-debug.log

But if I then do this,

zach@znbk:~$ npm remove -g reason-cli
removed 1 package in 0.506s
zach@znbk:~$ npm install -g 'git+https://github.com/reasonml/reason-cli.git#3.0.1-bin-linux'
[snip]
+ reason-cli@3.0.1
added 1 package in 43.779s
zach@znbk:~$ npm outdated -g
Package     Current  Wanted  Latest  Location
reason-cli    3.0.1     git     git

Since it's installed from the git repo it's expected that it would show that it's out of date. That seems preferable to breaking the command.

andreypopp commented 6 years ago

@zploskey sorry, I wasn't being clear. I was referring to your comment regarding installation with yarn:

Using yarn gets you the joy of rebuilding ocaml and bs-platform repeatedly, unfortunately. Maybe for now we should switch the recommendation to use the git tag as you suggest.

It should be fixed in 3.0.x releases. It's a bug if not.

zploskey commented 6 years ago

@andreypopp No worries, it was good to clarify when this bug is actually triggered and what alternatives we have. I can check the yarn issue out again too, but I don't think it's resolved based on experiencing it in the last few days. It's due how yarn handles native dependencies. See this issue: https://github.com/yarnpkg/yarn/issues/932 and https://github.com/BuckleScript/bucklescript/issues/2207

superherointj commented 6 years ago

This is a duplicate: https://github.com/reasonml/reason-cli/issues/48

crudh commented 6 years ago

I installed 3.1.0 from the npm registry (according to the new documentation) on macOS. It worked fine but when I do npm outdated -g I get the following:

Package          Current           Wanted        Latest
reason-cli       3.1.0-darwin      3.1.0-linux   3.1.0-darwin

So it wants to replace my darwin version with the linux version. Not a major issue, but something to be careful with when you want to upgrade all global packages.

zploskey commented 6 years ago

On Linux it says it "wants" the darwin version. The original problem in this issue has been fixed, as far as I can tell, by publishing to npm. Outdated is no longer broken, but it does show an extra entry.

develop7 commented 6 years ago

@zploskey makes sense; closing