brock / node-reinstall

Complete Node Reinstall for OSX and Linux

Home Page:http://git.io/node-reinstall

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Installation instructions not working

chromeo opened this issue · comments

After installing bpkg I copy/pasted your installation details, but got these errors:
$ bpkg install -g brock/node-reinstall

info: Install /brock/node-reinstall/master from remote https://raw.githubusercontent.com [https://github.com]
error: Remote unreachable: https://raw.githubusercontent.com
error: package not found on any remote

Then I tried your alternate install:
$ git clone git@github.com:brock/node-reinstall.git

Cloning into 'node-reinstall'...
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

I then used the link github provides, install worked:
$ git clone https://github.com/brock/node-reinstall.git

Cloning into 'node-reinstall'...
remote: Counting objects: 125, done.
remote: Total 125 (delta 0), reused 0 (delta 0), pack-reused 125
Receiving objects: 100% (125/125), 20.95 KiB | 0 bytes/s, done.
Resolving deltas: 100% (56/56), done.
Checking connectivity... done.

I ran your final instructions:
$ cp node-reinstall/node-reinstall.sh ~/bin/node-reinstall

Then the command:
$ node-reinstall

But no joy (even in a fresh Terminal):

-bash: node-reinstall: command not found

Any idea what I'm doing wrong?

I answered the last question, I need ~/bin added to my PATH. So after that I ran the node-reinstall command:

$ node-reinstall

Password:
Installing Node, npm.
/Users/garydarling/bin/node-reinstall: line 126: /Users/garydarling/.nvm/nvm.sh: No such file or directory
/Users/garydarling/bin/node-reinstall: line 134: nvm: command not found
/Users/garydarling/bin/node-reinstall: line 135: nvm: command not found
/Users/garydarling/bin/node-reinstall: line 146: syntax error in conditional expression: unexpected token `;'
/Users/garydarling/bin/node-reinstall: line 146: syntax error near `;'
/Users/garydarling/bin/node-reinstall: line 146: `if [[ $OSTYPE =~ "darwin"]]; then'

None of those messages feels like a succesful node reinstall - am I wrong?

@chromeo I'll answer the ones I think I can say for sure from here

  1. Installing from bpkg: I'm not sure why bpkg would have failed, and I didn't see any related issues
  2. I'm guessing that you haven't setup "ssh" with github, so yes, using http cloning would be the alternate there. More info here if you want to setup ssh: https://help.github.com/articles/set-up-git/
  3. You've already solved the issue with ~/bin in your $PATH, but my guess to that last one was going to be sourcing your profile or restarting your terminal. If it still isn't working, possibly just running bash node-reinstall.sh from inside the git repo would get it going.

@chromeo Based on the very first error you provided, I'm going to guess that this had to do with a connectivity issue with raw.githubusercontent.com. The first error would suggest it:

error: Remote unreachable: https://raw.githubusercontent.com

And I think the last error you posted confirms it:

/Users/garydarling/bin/node-reinstall: line 126: /Users/garydarling/.nvm/nvm.sh: No such file or directory

Line 126 does this:
source $HOME/.nvm/nvm.sh

But just above that line it tries to get it from raw.githubusercontent.com as well:
curl -sL https://raw.githubusercontent.com/creationix/nvm/$STABLE/install.sh | bash

I'll work on adding some error checking to make sure we have connectivity, but does this sound like it could have been the issue?

EDIT: forgot to say, Thanks for reporting this! 🌟

Looks like I have ssh setup already:
$ ls -al ~/.ssh

total 24
-rw-------   1 garydarling  staff  1766 Sep 27  2013 github_rsa
-rw-r--r--   1 garydarling  staff   400 Sep 27  2013 github_rsa.pub

I restarted Terminal, same results. FYI, I came across your solution in the SO thread that also details some manual removal of npm. I had gone thru most of those steps prior to trying this approach, so many of the node folders are already gone.

Those ssh credentials are associated with my GitHub for Mac client, but I assume they work when using Terminal. Not my area of expertise tho.

You mention running bash node-reinstall.sh from inside the git repo - how exactly would I do that? The only node-reinstall I can find on my system is the executable file inside ~/bin.

Verified ssh is working:
$ ssh -T git@github.com

Hi chromeo! You've successfully authenticated, but GitHub does not provide shell access.

You should be able to go into the repository that you've cloned and just type the command bash node-reinstall.sh if you copied the file from there.

I tried this, hope that is what you meant:
#navigate to repo
$ cd documents/node-reinstall

node-reinstall garydarling$ bash node-reinstall.sh
Password:
Installing Node, npm.
node-reinstall.sh: line 126: /Users/garydarling/.nvm/nvm.sh: No such file or directory
node-reinstall.sh: line 134: nvm: command not found
node-reinstall.sh: line 135: nvm: command not found
node-reinstall.sh: line 146: syntax error in conditional expression: unexpected token `;'
node-reinstall.sh: line 146: syntax error near `;'
node-reinstall.sh: line 146: `if [[ $OSTYPE =~ "darwin"]]; then'

Okay, would you mind to try running this command and tell me if you get any output:

curl -s https://github.com/creationix/nvm/ | grep "curl https://raw.githubusercontent.com/creationix/nvm/" | grep -oE "v\d+\.\d+\.\d+"

This is used to find out what the latest stable version of NVM is, but if it fails then it wouldn't be setting up NVM correctly.

I got no output

Okay, lastly, just to make sure I'm fixing the right thing, would you mind to break that apart and run the first two parts of the command?

So this one first should quickly show the html in your terminal from the page:
curl -s https://github.com/creationix/nvm/

If that works, try this:
curl -s https://github.com/creationix/nvm/ | grep "curl https://raw.githubusercontent.com/creationix/nvm/"
You should see this response:
<pre><code>curl https://raw.githubusercontent.com/creationix/nvm/v0.25.1/install.sh | bash

If everything works up until this point, I'd like to see the output of this:
grep --version
curl --version

That first ones gives no output
$ curl -s https://github.com/creationix/nvm/
$

I ran it again with the --show-error option:
$ curl -s -S https://github.com/creationix/nvm/

curl: (60) SSL certificate problem: unable to get local issuer certificate
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

I ran it with the -k option and got the html:
$ curl -s -k https://github.com/creationix/nvm/

<!DOCTYPE html>
<html lang="en" class="">
etc...

Here is the output for grep and curl after I added the -k option:
$ grep --version

grep (BSD grep) 2.5.1-FreeBSD

$ curl --version

curl 7.35.0 (i386-apple-darwin10.2.0) libcurl/7.35.0 OpenSSL/1.0.1j zlib/1.2.8
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp 
Features: IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP 
$ 

Thanks @chromeo Try this now and see if you get the result of "v0.25.1"

curl -s -k https://github.com/creationix/nvm/ | grep "curl https://raw.githubusercontent.com/creationix/nvm/" | grep -oE "v\d+\.\d+\.\d+"

Yes I do

FYI, I added -k to the curl command at line 124, reran $ bash node-reinstall.sh and saw some progress (I also echo'd some comments to track the path):

Installing Node, npm.
Go home and install NVM just because I feel safe there
Get the latest stable version number of nvm from the repo's homepage
=> Downloading nvm from git to '/Users/garydarling/.nvm'
=> Cloning into '/Users/garydarling/.nvm'...
remote: Counting objects: 3625, done.
remote: Total 3625 (delta 0), reused 0 (delta 0), pack-reused 3625
Receiving objects: 100% (3625/3625), 773.28 KiB | 0 bytes/s, done.
Resolving deltas: 100% (2084/2084), done.
Checking connectivity... done.
* (detached from v0.25.1)
  master

=> Appending source string to /Users/garydarling/.bashrc
=> Close and reopen your terminal to start using nvm
Execute install of v0.25.1
install the latest 0.10 version of node then set it as the default
Version '0.10' not found - try `nvm ls-remote` to browse available versions.
! WARNING: Version '0.10' does not exist.
default -> 0.10 (-> N/A)
node-reinstall.sh: line 148: syntax error in conditional expression: unexpected token `;'
node-reinstall.sh: line 148: syntax error near `;'
node-reinstall.sh: line 148: `if [[ $OSTYPE =~ "darwin"]]; then'

@chromeo If you re-install from bpkg now, version 0.0.8 should take care of all bugs. Let me know if you see anything else pop up, and thanks again for reporting this.