Rails webpacker can't find node version from nvm - ruby-on-rails

I'm getting this error when running rails server.
sh: 1: node: not found
sh: 1: nodejs: not found
Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/
also when trying to install webpacker:install
sudo rails webpacker:install
sh: 1: node: not found
sh: 1: nodejs: not found
Node.js not installed. Please download and install Node.js https://nodejs.org/en/download/
I'm using nvm manage my node and it works fine.
test_app4 [master] node -v
v8.16.0
How can i get rails to find my node instance from nvm?
EDIT:
If i install node via apt-get. Rails finds that node version which is found with nodejs -v. Just not sure why it doesn't find the nvm version.

Related

-bash: amplify: command not found (even after installing amplify) in MacBook

In my swift application we are aws amplify so I need install in my system.
After installing node modules,I installed typescript after that I installed amplify using following command (sudo npm install -g #aws-amplify/cli --unsafe-perm=true) and its was success but when give amplify -v it throws command not found error.
Note - In bin folder I can see npm,tsc but I cant see amplify.
If I run the application I am getting the following error.
warning: AmplifyTools has been deprecated. More info: https://github.com/aws-amplify/amplify-ios/blob/main/AmplifyTools/README.md
(not in PATH env variable)
npm WARN exec The following package was not found and will be installed: amplify-app
error: Minimum version required of Amplify CLI is not installed.
Min required version: (4.22.0)
Found Version: ([0m5.0.0[0m)
To install the latest version, please run the following command:
npm install -g #aws-amplify/cli#latest

script/plugin says command not found when the file exists

I'm trying to upgrade rails 2.x to rails 3.0.0.
I am following this guide (http://www.rails-upgrade-checklist.com/#3.0) and it says to download this rails upgrade tool:
script/plugin install git://github.com/rails/rails_upgrade.git
When I try that I get an error:
$ script/plugin install git://github.com/rails/rails_upgrade.git
-bash: script/plugin: Permission denied
$ sudo script/plugin install git://github.com/rails/rails_upgrade.git
Password:
sudo: script/plugin: command not found
$ ls script/
about dbconsole destroy performance process server spec_server
console delayed_job generate plugin runner spec spin
$
How do I get this to work, I'm stuck on such an early step :)

Unable to install Ruby 2.4.0 using rbenv on Ubuntu 16.04 LTS

I am trying to install Ruby 2.4.0 using rbenv and I get an error as shown below
`a#a:~$ rbenv install 2.4.0
Downloading ruby-2.4.0.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.0.tar.bz2
error: failed to download ruby-2.4.0.tar.bz2
BUILD FAILED (Ubuntu 16.04 using ruby-build 20170726)
Inspect or clean up the working tree at /tmp/ruby-build.20170806000333.10203
Results logged to /tmp/ruby-build.20170806000333.10203.log
Last 10 log lines:
/tmp/ruby-build.20170806000333.10203 ~
Unable to establish SSL connection.
`
I am totally clueless on how to resolve this. I'll be glad if someone could please help me.
Thanks in advance.
probably this steps can help you solve the problem
mkdir ~/.rbenv/cache
rbenv install 2.4.0
or
mkdir ~/.rbenv/cache
# download manually ruby file
wget https://cache.ruby-lang.org/pub/ruby/2.4/ruby-2.4.0.tar.bz2
# move file
mv ruby-2.4.0.tar.bz2 ~/.rbenv/cache
# do the install
rbenv install 2.4.0
Do you have any firewall that might be blocking it?

How to resolve Rails issue- An error occurred while installing mysql2 (0.4.4), and Bundler cannot continue

you may get this issue while working on Rails 4.0 and above version along with Ruby 2.0 and above.
this is very common issue if you are going ahead with up gradation of Rails environment.
Steps to be follow-
For Windows System-
1.Download the the newest mysql-connector to c:\mysql-connector folder
2. gem install mysql2 -- '--with-mysql-include="C:\mysql-connector\include" --with-mysql-lib="C:\mysql-connector\lib"
Hopefully it will work for you.
For Ubuntu System-
1. open terminal (Ctrl+alt+T)
2. $ sudo apt-get install libmysqld-dev
Run bundle from your project directory
3. $ bundle
This will resolve the issue.We can also see the solution here.
https://randvblog.wordpress.com/2016/06/20/how-to-resolve-rails-issue-an-error-occurred-while-installing-mysql2-0-4-4-and-bundler-cannot-continue-make-sure-that-gem-install-mysql2-v-0-4-4-succeeds-before-bundling/
I got this issue resolved with following steps as-
open terminal (Ctrl+alt+T)
$ sudo apt-get install libmysqld-dev
Run bundle from your project directory
$ bundle
rails s
Now rails app is working fine.

Rails Can't Find NodeJS Even Though it is Installed

When I run "rake assets:clean" I get the error:
ExecJS::RuntimeUnavailable: Node.js (V8) runtime is not available on this system
There are several posts about this, but they all say "install nodejs"
I have installed nodejs though.
$ which nodejs
/usr/bin/nodejs
$ nodejs -v
v0.10.25
And also nodejs legacy
$ which node
/usr/bin/node
$ node -v
v0.10.25
I'm on Ubuntu 14.
$ rake about
...
Ruby version 1.9.3 (x86_64-linux)
RubyGems version 2.4.3
Rack version 1.4
Rails version 3.2.13
JavaScript Runtime Node.js (V8)
Active Record version 3.2.13
....
What is really killing me is that this was working fine until I tried to remove a binstubs warning by cleaning the bin directory.
I've tried to undo everything I did to fix the binstubs issue - going back to a clean version in git, reinstalling rvm, reinstalling ruby, reinstalling my gems. I'm out of ideas on how to fix this.
I wonder if it's something stupid like an issue with my PATH:
$ echo $PATH
/home/andy/.rvm/gems/ruby-1.9.3-p551/bin:/home/andy/.rvm/gems/ruby-1.9.3-p551#global/bin:/home/andy/.rvm/rubies/ruby-1.9.3-p551/bin:/home/andy/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/heroku/bin
I had added "PATH: './bin:$PATH'" to my local_env.yml file. See comment above. Doh!

Resources