Installing foreman on Ubuntu from source - node.js

I'm working locally on a NodeJS Heroku app, and I'd like to use foreman to run my app. It apparently didn't install with the Heroku toolbelt (has anyone else had this problem?).
Is there a way to re-install the Heroku toolbelt to get foreman? Or could I get foreman from git? I saw the instructions here but after getting the repo and executing:
git submodule init
git submodule update
It still says that the "foreman" command is not found. What can I do to get foreman to work?
Thanks
Edit: I'm using Ubuntu

Your best bet is to probably install it with Rubygems. You don't mention which OS your on, but we'll assume your not on something mental like Windows (;))
gem -v
if you've got a version back, skip the next bit. You should only need to install RubyGems on Ubuntu (OS X has it in most recent versions)
Ubuntu only
sudo apt-get install rubygems
then
gem install foreman

The project you linked to, http://theforeman.org/projects/foreman, is not Heroku's foreman.
Heroku's foreman is a Ruby gem, and must be installed as a Ruby gem:
$ [sudo] gem install foreman
Whether you need to use sudo depends on your environment, how you installed ruby and rubygems, etc.

I just wanted to amend #Neil's answer. You need to install ruby, not rubygems.
sudo apt-get install ruby
When Ruby is installed you can then install foreman.
gem install foreman --no-rdoc --no-ri
(You don't need --no-rdoc --no-ri but I like to install gems without the documentation on production boxes)
Also take a look at rvm if you're a Ruby person. You might not want to use Ubuntu/Debian's version of Ruby.

Related

I installed tsc through apt and now I don't know how to remove or update it

So I was missing typescript on my server and tryed to run tsc and I got the message "don't recognize tsc command, did you mean to install it using apt install tsc?" or something like that. Not really thinking about it, I ran the command. Usually I'd install it using npm i -g typescript. It did install typescript but at the wrong version (2.7.something and i need 4.0+) and runing tsc -v returns the version, but apt-get update doesn't update it, it doesn't turn up on the list when I run dpkg --list, apt-get remove/apt remove tsc/typescript does nothing (can't find package tsc/typescript) but the tsc command does work and attempts to compile my files but throws a bad type error because it's an old version. npm uninstall/remove -g tsc/typescript also does nothing.
How do I remove this tsc and install typescript normally through npm?
EDIT: I should also note, it's not installed locally in some folder. I get the same behaviour anywhere on the server.
Here's a screenshot of some of the commands I tried and the result I got:
(Note: Additional information can be found in the chat discussion)
TL;DR: It's probably because you've installed the node-typescript package via apt-get at some point, which only provides v2.7.2 as the latest version of TypeScript for your current Ubuntu version (which you've specified is 18.04 LTS, or Bionic Beaver).
This means that you either have to:
Switch to a newer version of Ubuntu (e.g. the latest stable, 20.04 - Focal Fossa) which offers v3.8.3 as the current version, or
Uninstall the node-typescript package (with sudo apt-get remove node-typescript) and instead install TypeScript via NPM. This means that TypeScript updates are now decoupled from Ubuntu releases.

Error installing nodejs in arch linux

Okay so i just made a fresh install of nodejs package on archlinux using pacman. Command for the same was
sudo pacman -S nodejs npm . Now when i tried to run the same i am getting error as
node: error while loading shared libraries: libicui18n.so.57: Which pretty much means that libicu is either not there or not the correct version. The problem that i am facing is that it is not there in pacman. I tried
sudo pacman -S libicu, which returned not able to find the package. What is the right way to resolve this issue. FYI : just a note, i would prefer not to install from source and prefer using pacman for the same. If there is any other output that you need to know please comment below and will let you know about the same.
I am currently on manjaro i3 fresh install.
Just found out, The name for package in arch linux is icu and not libicu. Once that is installed node will start working fine.
Update
After using node for quite sometime i realised that a better way to install node is using NVM. It would install both node and npm locally and you get the option to manage multiple version.Installation is as simple as
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
This error is caused by installing node js and npm package modules with missing packages that are unsupported by your system how about you try this:
$ sudo pacman -Rsc -n nodejs
$ sudo pacman -Sy nodejs
$ sudo pacman -Sy npm
did you use testing repo?
If you enabled testing repositories, but later on decided to disable them, you should:
Remove/Comment them from /etc/pacman.conf
pacman -Syuu to "rollback" your updates from these repositories.
The second item is optional, but keep it in mind if you notice any problems.
Also you can install stable ver : pacman -S core/icu
You just need to update arch
sudo pacman -Syu

"spawn.h not found" while installing octopress on Cygwin

I have been trying to install octopress on cygwin. I have googled but no avail. I hope that someone can suggest a hack (no matter how complicated) to resolve this.
I followed the octopress installation instructions. Everything went smoothly till the bundle install stage. When I reached that point, the installation quits with the error telling that it couldn't find spawn.h.
I searched and apparently spawn.h doesn't come in any of the cygwin libraries. I installed all the c++ libraries I could from cygwin setup but that did not help.
Can you please help resolve this?
I think the gem that fails in this process is posix-spawn. For this, you could install the gem locally:
$ gem install rake-compiler -v 0.7.6
$ git clone git://github.com/rtomayko/posix-spawn.git
$ cd posix-spawn
$ rake gem
$ cd pkg/posix-spawn-0.3.6
$ gem install --local posix-spawn-0.3.6.gem
The explanation (from an article I found):
There is a bug in the version of posix-spawn in the gem repositories however that makes installing via gem impossible on Cygwin
After this, try bundle install again, it should be successful.
Here's a related issue on the GitHub project
UPDATE: I recently installed scoop a command-line installer for Windows, a pretty easy setup. I installed Ruby, bundler and octopress without breaking a sweat. You should give it a try.

Installed node.js ver 0.8 but node --version still shows previous version 0.6.12

I tried installing node ver 0.8 on my ubuntu 12.04.It already has a node ver 0.6.12.The installation went suceesfully but when i type in
node --version
it still shows previous version.
i tried to remove previous version using sudo apt-get remove node but it says package node is not installed.But on trying node --version it shows 0.6.12
Why is it so??
The problem is, you need to replace the new location for node with the old in your PATH variable. If you have an old manual install, find the old path to node by running echo $PATH. Then run this command:
export PATH=${PATH%$OLD_NODE_PATH/bin*}$NEW_NODE_PATH/bin${PATH#$*OLD_NODE_PATH/bin}
Or if you are using an install from the apt-get repository, just run:
export PATH=$NEW_NODE_PATH/bin
And that should fix your problem. But there is a better way! The best tool to manage your node.js environment is NVM. It exactly like RVM for ruby and similar to virtualenv for python, if you are familiar with those tools. It allows you to switch versions of node and download new ones extremely efficiently, and is easy to use. Download and install with:
curl https://raw.github.com/creationix/nvm/master/install.sh | sh
Then add this line to your bash (assuming you are running a bash shell) where it will be loaded (I prefer .bash_login for the personal stuff although it is not loaded by default):
[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh
Source your bash script or restart the terminal then enter this command:
nvm install 0.8.0 && nvm use 0.8.0
This should set you up just fine. Although not necessary, you should probably get rid of all the other node installs, for the sake of tidiness. Check out their github page but to get you started here is a quick overview:
nvm ls # list all installed versions of node
nvm ls-remote # list all available versions of node
nvm install 0.9.8 # download and install node v0.9.8
nvm use 0.8.0 # switch current environment to use node v0.8.0
nvm alias default 0.8.0 # set 0.8.0 as default, you can use 'nvm use default'
nvm deactivate # use system install of node
nvm run default app.js # run app.js with default node version
I had this issue until I followd the directions on
https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
which included running:
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
first. Then running sudo apt-get install nodejs npm got me to 0.8.x
Also see: http://apptob.org/
Seem like you install nodejs package from Ubuntu repo and manually install node 0.8 after?
Try remove nodejs package.
The way to get a more recent version of Node.js is to add a PPA (personal package archive) maintained by NodeSource. This will probably have more up-to-date versions of Node.js than the official Ubuntu repositories.
First, you need to install the PPA in order to get access to its contents:
curl -sL https://deb.nodesource.com/setup | sudo bash -
The PPA will be added to your configuration and your local package cache will be updated automatically. After running the setup script from nodesource, you can install the Node.js package using the below command.
sudo apt-get install nodejs
You can check the node by using this command
node -v

Need Advice: Latest version of Node.js vs using Synaptic Package Manager?

I'm trying to get node.js and npm installed on my Ubuntu 11.10 installation, and I'm having a tricky time. I decided to go the route of downloading and compiling from the latest source because I want to use the new version of node.js - v0.6.0 instead of the older version that the synaptic package manager will install. However, I could not get npm set up correctly with it due to a "module not found" error. I was completely surprised at how little information I was able to find on the error.
Anyways, my goal here is to learn node.js, not to run a production environment. Should I give in and use v4.9 or is it really worth getting the newest version for the sake of learning, even if I have to go through the pain of keeping it updated and configuring it myself?
If you have Ubuntu, install it from Chris Lea's repo, it's always up to date with the last stable version (for ex now the version is 0.6.0 - as of today):
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
Generally, you want to install node from source since the packages you find in package managers are usually out of date. 0.4.12 was the last stable before 0.6.0 that was released a few days ago. 0.4.9 is pretty out of date.
This is a old question, nowadays my preferred way to install node is by using nvm (Node Version Manager). This will allow you to have multiple versions of node installed and quickly switch version.
Installation:
Install C++ compiler
apt-get update
apt-get install build-essential libssl-dev
Install NVM
curl https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash
source ~/.profile
Install node (select which version you want to install)
nvm install 6
Usage:
To set a default node version:
nvm alias default 0.12.7
To select a different installed version:
nvm use 4

Resources