Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with nodejs.sh #172

Closed
LimeBlast opened this issue Feb 28, 2014 · 28 comments
Closed

Issues with nodejs.sh #172

LimeBlast opened this issue Feb 28, 2014 · 28 comments

Comments

@LimeBlast
Copy link
Contributor

I don't know if this is related to the change we made earlier (probably is mind you), but now when I run vagrant up I'm getting the following errors:

/tmp/vagrant-shell: line 53: nvm: command not found
/tmp/vagrant-shell: line 56: nvm: command not found
/tmp/vagrant-shell: line 58: nvm: command not found
/tmp/vagrant-shell: line 63: npm: command not found
/tmp/vagrant-shell: line 88: npm: command not found

which I've tracked down to being within the nodejs.sh file.

I know that part of the script sets path info and some other bits, so I'm wondering if they need to be re-sourced (is that the correct term?) like they are in the rvm.sh file?

@LimeBlast
Copy link
Contributor Author

Hhmm, I've just had a look in the nodejs.sh file again, and I see that lines 34 - 42 actully do this re-sourcing - but this happens above the 65 - 80, which seem to do some more to the .profile file, etc..

Should lined 34 - 42 be moved below 65 - 80, or should they maybe be duplicated?

(Sorry, I don't have enough experience with this stuff to know what the right answer is)

@LimeBlast
Copy link
Contributor Author

One more thing I've noticed - .bash_profile seems to be back. It contains the following:

[[ -s /home/vagrant/.nvm/nvm.sh ]] && . /home/vagrant/.nvm/nvm.sh # This loads NVM

I've got a feeling this has come from the NVM install script being referenced: https://gist.githubusercontent.com/Ilyes512/8335484/raw/nvm_install.sh

@LimeBlast
Copy link
Contributor Author

I think we broke more than we fixed when we changed the .bash_profiles to .profile

@gstjohn
Copy link
Contributor

gstjohn commented Feb 28, 2014

Experiencing the same here.

@LimeBlast
Copy link
Contributor Author

I could be thinking in totally the wrong direction here, but I think, because we probably want to keep using .profile rather than .bash_profile, if we take the contents of https://gist.githubusercontent.com/Ilyes512/8335484/raw/nvm_install.sh and bring it inside our nodejs.sh file (then update the reference to .bash_profile accordingly), we might be onto a winner.

I'm just in the process of testing the other files which were edited to see if they've fallen over as well.... sorry guys, I think this is totally my fault.

@fideloper
Copy link
Owner

Good call, that external script needs updating. No fault, no worries. We're allowed to break stuff, it's open source!

@fideloper
Copy link
Owner

Paging @Ilyes512 :D

@LimeBlast
Copy link
Contributor Author

Continuing my investigations, I've come across another error:

>>> Start installing Ruby Gems
In case of problems: http://rvm.io/help and https://twitter.com/rvm_io
No binary rubies available for: ubuntu/12.04/x86_64/ruby-2.1.1.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 11.4M  100 11.4M    0     0   790k      0  0:00:14  0:00:14 --:--:--  773k
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /opt/vagrant_ruby/lib/ruby/gems/1.8 directory.

This one seems to be related to rvm.sh file

@LimeBlast
Copy link
Contributor Author

@fideloper would it not be better for @Ilyes512's script to be part of the Vaprobash repo?

@fideloper
Copy link
Owner

Since it's semi-specific to Vaprobash, I'm thinking that could be part of nvm.sh instead of separate, yes.

@Ilyes512
Copy link
Contributor

Will look at it at home. At the gym right now :)

@LimeBlast
Copy link
Contributor Author

Other than the additional issue with the rvm.sh file, I can't find any other problems. That's not to say there aren't any, it just means I can't find them :)

No idea what's causing the rvm issue I'm sorry to say.

@LimeBlast
Copy link
Contributor Author

@Ilyes512 Updating the nvm_install.sh file of the remote gist as shown here: https://gist.github.com/LimeBlast/9287786 - fixes the nodejs issue.

@fideloper As I said before, I think this script should be part of the vaprobash repo, but I don't know within what context (i.e. should be be dumped, as is, into the middle of the nodejs.sh file, or should is exist in another folder on the repo?

I have the same question of the vhost script file: https://gist.githubusercontent.com/fideloper/2710970/raw/vhost.sh - rather than this script existing as a gist, an additional folder (called tools maybe?) could be created in the repo, and all these little gists covering small bits of functionality could be put into it.

Doing something like this would allow for pull requests to be made on these files, and might help avoid issues such as the one we've had by changing all references from .bash_profile to .profile

Still no idea how to fix the rvm issue, but am looking into it now. I did stumble upon this however: bryannielsen/Laravel4-Vagrant#20 - seems I've had exactly the same issue with another vagrant script.

@Ilyes512
Copy link
Contributor

Ilyes512 commented Mar 1, 2014

On it right now, should be fixed within the hour. I also think it's because of the gist, cause that was the last thing I changed (and didn't tested on later). Keep you posted!

edit:
BTW, where you using ZSH?

edit2:
This probably got to do with resourcing. Cause the error's say it can't find NVM, but once you ssh into it, it's there.

@fideloper
Copy link
Owner

Gotcha. sourcing .profile should technically also source .bashrc but perhaps that assumption isn't valid.

@Ilyes512
Copy link
Contributor

Ilyes512 commented Mar 1, 2014

I think I got it:
8c765cd
It changed .bash_profile to .profile. So we are using .profile now instead of .bash_profile? If so then Limeblast's solution of changing the variable should work. I will test it now.

@fideloper
Copy link
Owner

Right - to be more accurate, .bash_profile doesn't seem to be a file Ubuntu uses (it prefers .profile, which in turns calls in .bashrc which in turn sets settings and also looks for .bash_aliases and .bash_completions).

I think another install script may have created .bash_profile (mistakenly?) which a lot of us then started sourcing when seeing what other scripts did.

@Ilyes512
Copy link
Contributor

Ilyes512 commented Mar 1, 2014

Ok, nice to know. So does that mean one can assume .profile will always exist? (So no check needed for it?)

edit:
Ok, without using ZSH it's now working again. I will test ZSH as well, but first want to find the cause if this:

>>> Installing Node Version Manager
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1012    0  1012    0     0    371      0 --:--:--  0:00:02 --:--:--   601
Cloning into '/home/vagrant/.nvm'...
>>> Appending source string to /home/vagrant/.profile
sh: 32: [[: not found
>>> Installing Node.js version latest
    This will also be set as the default node version
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  6318  100  6318    0     0   8019      0 --:--:-- --:--:-- --:--:-- 18419
######################################################################## 100.0%
Now using node v0.10.26
default -> v0.10.26
Now using node v0.10.26
>>> Starting to config Node.js

This line sh: 32: [[: not found

@fideloper
Copy link
Owner

Right, Ubuntu 12.04 will always have .profile.

On Sat, Mar 1, 2014 at 5:06 PM, Ilyes [email protected] wrote:

Ok, nice to know. So does that mean one can assume .profile will always
exist? (So no check needed for it?)

Reply to this email directly or view it on GitHubhttps://github.com//issues/172#issuecomment-36438316
.

@Ilyes512
Copy link
Contributor

Ilyes512 commented Mar 1, 2014

So it's working if your not using ZSH, but something goes wrong with this:

# Check if .zshrc exist
if [[ -f "$ZSHRC" ]]; then
  # Append NVM script to ~/.zshrc
  if [[ ! grep -qsc 'nvm.sh' $ZSHRC ]]; then
    echo ">>> Appending source string to $ZSHRC"
    echo $SOURCE_STR >> "$ZSHRC"
  else
    echo ">>> Source string already in $ZSHRC"
  fi
fi

Somehow if [[ -f "$ZSHRC" ]]; then is not evaluated as true. I am going to try using a variable to check if ZSH is installed and try it that way.

edit:
Ok, it's working again for both bash and zsh. I still don't understand why this fails: if [[ -f $ZSHRC" ]]; then and that this seems to work: if [ -f "$ZSHRC" ]; then.

@LimeBlast
Copy link
Contributor Author

Do we have any idea why the RVM stuff is still failing? I've never had much luck with Ruby or RVM, but I've tested the install procedure provided in the last message the following page in a vaprobash box, and it works fine:

bryannielsen/Laravel4-Vagrant#20

Is it worth looking changing how RVM is installed?

@Ilyes512
Copy link
Contributor

Ilyes512 commented Mar 2, 2014

RVM is working again. It had to do with 2 things:

  1. Vaprobash switched from .bash_profile to the right dot-file .profile, but because I didn't knew about that I hadn't changed the RVM gist as well.
  2. I didn't tested out .ZSH cause I assumed it would work (only made a small change where I added a check to see if the ZSH file existed. I find Bash a little inconsistent looking at the result I expected. I should always just test it out after changing something.)

And about your link and the installation mentioned. It's nothing different then was happening now except for the error that was caused because of the above and 2 other differences.

  1. He installs "build tools". You should check out if those are getting installed in the base.sh.
  2. He uses sudo which I don't try to use or else you will have to continuously have to use the sudo command.

I will run the current development branch and try and install guard to see if it's successfully installs it or not.

edit:
Oeps, hold on I thought you where talking about node.js ^^. I will still check it out.

@fideloper
Copy link
Owner

👍

@LimeBlast
Copy link
Contributor Author

Re: RVM, I'm still getting the same error as two days ago - #172 (comment)

The issue appears to be related to this block of code in rvm.sh:

# Install (optional) Ruby Gems
if [[ ! -z $RUBY_GEMS ]]; then
    echo ">>> Start installing Ruby Gems"

    gem install ${RUBY_GEMS[@]}
fi

The relevant section of my Vagrantfile looks like this:

# Languages and Packages
ruby_version          = "latest" # Choose what ruby version should be installed (will also be the default version)
ruby_gems             = [        # List any Ruby Gems that you want to install
  "bundler",
]
...
# Install Ruby Version Manager (RVM)
config.vm.provision "shell", path: "https://raw.github.com/#{github_username}/#{github_repo}/#{github_branch}/scripts/rvm.sh", privileged: false, args: ruby_gems.unshift(ruby_version)

@Ilyes512
Copy link
Contributor

Ilyes512 commented Mar 4, 2014

I have been testing it yesterday and I had no luck installing Guard. Ruby and RVM seemed to work. Need some further investigation, but it's something with not having the right permission's. Some gem's work fine while other's might not work.

@LimeBlast
Copy link
Contributor Author

Guard? Do you mean Bundler?

I know very little about RVM, so can't pinpoint the exact point of failure, but if you think it's the installing of the gem which is failing, do you have any joy with Bundler (because that is what i think might be failing for me)

Cheers :)

@Ilyes512
Copy link
Contributor

Ilyes512 commented Mar 4, 2014

Yeah, I tried it because of your link to this page: bryannielsen/Laravel4-Vagrant#20

And so I tried it out. I will test out installing Bundler later.

@LimeBlast LimeBlast mentioned this issue Mar 4, 2014
@LimeBlast
Copy link
Contributor Author

I'm going to close this issue because the title doesn't match the current problem. A new ticket for the RVM issues is here: #185

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants