Context: I would like to install clasp via npm for Google Apps Script development. I'm on Ubuntu 20.04.
apt-get -s install npm shows my machine trying to install python 2 - which I don't have and don't want.
Is it possible to install npm (and therefore clasp) without having to accept python 2 and getting mired in python version problems on my machine?
No, I'm quite sure npm needs python 2. I have both python 2 & 3 on my ubuntu 20.04, and I've never had any problems caused by using both.
Also, you should probably use apt install instead of apt-get (not a significant change just, more modern and faster). Here is a link on the differences: https://itsfoss.com/apt-vs-apt-get-difference/
Related
I want to install 11.x version of Node.js on my Ubuntu sevrer using apt/apt-get, but it always installs version 8.10.x. Is there a way to install the latest 12.x or 11.x version without using nvm?
I've tried apt-get update, purging nodejs, using commands below:
curl -sL https://deb.nodesource.com/setup_11.x | sudo -E bash -
sudo apt-get install -y nodejs
None of above helped. I'm still getting an old verion of Node.js
The implementations of languages provided by operating systems tend to lean towards stability within their particular ecosystem (i.e: they play nice with everything else in the repositories). If you wish to use a newer version I recommend asdf which allows you install multiple versions of implementations of various languages including Node.
I want to set up a Ubuntu VM with Python 3. All the resources I've seen so far want me to use virtualenv but I don't see the point since I only want one Python (I don't care about 2.7 in other words).
Is there a way to do this where I can just ssh into the VM and my environment is all set up for me?
There are no Ubuntu releases that default to Python 3. Maybe in the future, but as of right now, you will have to workaround the fact that Ubuntu ships with Python 2 as the default, Python 3 is available.
So pick a release of Ubuntu that you like, and then:
Upgrade the system (sudo apt update; sudo apt upgrade -y)
Install the build toolchain (sudo apt install build-essential -y)
Install Python3 (sudo apt install python3 python3-dev -y)
Switch your user to Python3 as the default; I would recommend using pyenv for this.
Once you do this, then for your user Python will default to Python 3, but for other system utilities, Python 2 will still be available.
It might just be easier to use the default Python docker image since its allows you to easily switch versions (it is based on debian).
I have been trying to get Gulp.js to work for 3 days and have failed so far. I have now resorted to reinstalling Linux Mint 17.3 from scratch... I want to install Node.JS on my machine and then run Gulp.
On nodejs.org https://nodejs.org/en/download/package-manager/it says:
two versions:
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
and then
sudo apt-get install -y nodejs
How can I know which version to install? For running Gulp cli which is the best way forward?
On many sites I read "do not use apt-get to install Node.JS" They never mention a reason. Apparently, it is better to use NVM (??)
So, can anyone explain it to me? Which version do I install? setup_4? setup_6? Which way to install Node.JS is the best way? apt-get or NVM? and especially WHY?
Thanx,
Thom
do not use apt-get to install Node.JS
In the past the distro packaging was ~~not so good~~ really bad and created problems. Also it was notoriously late in regards of the latest node version available. I m not sure today about apt, but on my fedora 23 i m still getting provided node#0.10. So for me it s a no go.
Apparently, it is better to use NVM
Node Version Manager helps to get setup and running quickly. It also helps you to switch between old/new versions very very quickly. awesome tool for developers.
V4? V6?
Depends of your task and its goal.
For example, you are creating a build chain for front end development, you may go for v6 because only the developers will be impacted by this decision. Its a decision to take with the team.
If you work on a server api, you should choose one in agreement with your sysop team (or force them, depends your context).
You are working on packages to be distributed (cli), go for the LTS v4, it s going to be more stable.
You do not have constraints ? Go for v4 for stability, v6 for the latest features about es6 for example.
hth!!
I've just installed nodejs on Debian 7 - by apt-get install nodejs.
Nodejs seems to be working fine, but when I enter "npm" I get "command not found".
"which nodejs" points to "usr/bin" and there it is - nodejs, but there is no npm file, what went wrong?
I found a few solutions, but all of them are related to Macs
BTW, "usr/local/bin" directory is empty I believe everything should install right there?
You have several options.
If you want to continue using Debian packages, you could install npm (debian maintainers have it in a separate package).
apt-get install npm
If you want to just install npm, you can use this modification of Maxime's answer:
curl -L https://npmjs.org/install.sh | sudo sh
(the -L is needed to make curl follow redirects.)
Finally, you may wish to use a different package source.
For some Linux distributions (Debian/Ubuntu and RedHat/CentOS), the latest node version provided by the distribution may lag behind the stable version. Here are instructions from NodeSource on getting the latest node, which includes npm and avoids using the problematic nodejs alias
Install npm
curl -L https://npmjs.org/install.sh | sudo sh
(the -L is needed to make curl follow redirects.)
and check version
npm -v
Node.js is easy to install in Linux
create a directory nodejs inside /usr/local/lib
download nodejs
move downloaded tar.xz file inside /usr/local/lib
extract the tar.xz file and rename as like node-v8.9.4
setup environment
cd ./etc/profile.d
ls
sudo touch nodejs-env.sh
sudo atom nodejs-env.sh
where atom is my favourite editor; you can use your editor.
copy and paste below code inside nodejs-env.sh and save
export NODEJS_HOME=/usr/local/lib/nodejs/node-v8.9.4
export PATH=$NODEJS_HOME/bin:$PATH
restart you machine.
done
There were several methods to install node.js on your debian. But I prefer this one:
Setup with Debian (as root):
apt-get install curl
curl --silent --location https://deb.nodesource.com/setup_0.12 | sudo bash -
Then install with Debian (as root):
apt-get install --yes nodejs
After that, relaunch your terminal and type "npm" in your terminal.
The problem you're facing is due the need of super user rights during the installation. As others mentioned, you could do it via the sudo command and the manual installer.
Either way, there're several ways to install node in *unix platforms in a safer way without the need of super user rights using NVM (Node Version Manager).
Steps:
$ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.25.4/install.sh | bash
$ nvm install 0.10
Also, you can find different techniques to install node and npm without having to sudo.
I'm currently migrating to new computer and I need to reinstall the software I am using which are:
Python 3.3,
Lighttpd (newest version),
Pymongo (newest version),
Ubuntu 12.04 Desktop (The System I'm using)
I started to install Python 3.3 by downloading it from the its official website (in tar.bz2 file) and by following this tutorial. Afterwards I installed Lighttpd and changed the lighttpd.conf for Python by following this tutorial, too.
I tried several paths for my cgi.assign, none of them worked. Especially /opt/python3.3/bin/python3.3 should be working, but it shows 500 - internal Server error all the time with a "hello world" test script.
Now regardless to this problem I have no clue on installing Pymongo. If I try to intall pip OR easy_install python3.3 I have to manually download it and execute the setup.py with my python3.3 executable, right? Because this always fails with an error:
`Error missing zlib on a bundle called distribute-0.7.3 (is this even the right tool I need, because it seems to be a legacy wrapper !?) or unknown url type: https for pymongo2.6.2 itself.`
I'm getting crazy with this setup. Why is this so difficult to handle? Other programs are just a few clicks to install even on a system like Ubuntu, but these particular development tools seem to be really difficult to install.If anybody has an idea on how to install all three together or has information on a better solution please help me out.
The system is used to program Python scripts in Eclipse and trying them out directly on the system (lighttpd). The database used is MongoDB. Python and MongoDB are communicating over the Pymongo driver. I am planning to use the system on a Server distribution on release and it has to be nicely scalable on a high amount of excecutions.
Thanks for your time,
It's easiest to use the Ubuntu repositories:
sudo apt-get update
sudo apt-get install python3 python3-pip lightppd python-pymongo
Or if that only installs the python2.x pymongo, use pip, which you've just installed:
sudo pip-3.3 install pymongo
Or better yet, use a virtualenv with the help of virtualenvwrapper (docs)
sudo pip install virtualenvwrapper
... # follow instructions for installing virtualenvwrapper
mkvirtualenv --python=/usr/bin/python3 -i pymongo mongoppd
workon mongoppd
... which will segregate the environment I've called 'mongoppd' from the rest of your system so you can't cause any trouble. Then you don't need sudo to pip-3.3 install things, just workon mongoppd then pip-3.3 install [...]. Or after the -i flag when you create the virtualenv to get it installed straight away.
In general, on Ubuntu, you should hardly ever have to install something manually. Your first attempt should be using sudo apt-get install (use tab-complete to see what's available or just google "ubuntu 12.04 packages [...]" and you'll find the list of packages). Then for python use pip install or pip-3.3 install as appropriate. You'll only need to run python setup.py install if you need to install a development version of a package or something obscure that's not on pip. I don't think there's a good reason to ever use easy_install these days.