Schniz / fnm

πŸš€ Fast and simple Node.js version manager, built in Rust
https://fnm.vercel.app
GNU General Public License v3.0
18.02k stars 461 forks source link

fnm install fails if target Node version already exists #34

Closed theandrewlane closed 5 years ago

theandrewlane commented 5 years ago

Issue:

fnm install only works when the Node version specified in the command (or .nvmrc) is not already present on the machine.

Steps:

  1. fnm install <some version>
  2. fnm use <same version as above>
  3. fnm install <same version as above>

Error: Macbook Pro - 10.13.3 (High Sierra)

[17:34:26]: some-project $ fnm install v11.9.0
Looking for node v11.9.0 for darwin x64
Downloading https://nodejs.org/dist/v11.9.0/node-v11.9.0-darwin-x64.tar.xz to /Users/user/.fnm/downloads/v11.9.0.tar.xz
Extracting /Users/user/.fnm/downloads/v11.9.0.tar.xz to /Users/user/.fnm/node-versions/v11.9.0
fnm: internal error, uncaught exception:
     Unix.Unix_error(Unix.ENOTEMPTY, "rename", "/Users/user/.fnm/node-versions/v11.9.0/node-v11.9.0-darwin-x64")
     Raised by primitive operation at file "src/unix/lwt_unix.cppo.ml", line 235, characters 14-31
     Re-raised at file "executable/Install.re", line 75, characters 2-104
     Re-raised at file "src/core/lwt.ml", line 2987, characters 20-29
     Called from file "src/unix/lwt_main.ml", line 26, characters 8-18
     Called from file "cmdliner_term.ml", line 25, characters 19-24
     Called from file "cmdliner.ml", line 116, characters 32-39

Use Case: To ensure the same version of Node is used on all of my build servers, I'd like to add the fnm install and fnm use commands to my build pipeline. Updating the Node version in a repository's .nvmrc is much easier than manually updating each build server 😁

Schniz commented 5 years ago

Hey! Thanks for the issue, it’s a valid use case :) I believe #27 will fix that! What do you think?

Sent with GitHawk

theandrewlane commented 5 years ago

@Schniz Yep, #27 is the same issue. Guess I didn't search hard enough πŸ˜‚

Feel free to close this, thanks!

Schniz commented 5 years ago

Hehe - it's all good! thanks for opening the issue anyway πŸ˜„