How to install nvm offline on Linux - linux

I need to install nvm on a Linux server without Internet and without sudo privilege, but I can transfer any file to this offline server. I tried to use package from https://github.com/nvm-sh/nvm, but when I tried sh install.sh, it reports unable to access https://github.com/nvm-sh/nvm.git/. Is there a way to install nvm without Internet on Linux?

You need to install NVM with internet connection, I haven't figured out how to install nvm locally, after that you also need to download whichever version of node you want from using a terminal that requires internet, and after those two steps, then you can change node version required.

Related

Why is there a nodejs directory in ubuntu subsysem when nodejs is not installed?

I just installed the ubuntu subsystem.
I have not installed node yet but it has a nodejs directoy under /mnt/c/Program files/nodejs.
The problem is that I can run npm after installing node. It gives me this error:
I uninstalled and reinstalled the linux subsystem, but the directroy is always there. I tried all of the solutions online for dealing with this error but none of them worked.
I can't even remove this directroy because of permissions. Even sudo-ing won't work.
How can i fix this and get npm running?
The folder you’re browsing to is actually your Windows installed Node version.
You’re better off installing nvm or just using nodesource to download and install Node.
NVM is my preference if you’re needing to install multiple versions for dev purposes etc. nvm

LESS instalation - node file does not exist on Linux

I'm trying to install LESS css in Netbeans, but I'm running into one problem after another. As such, I already have LESS installed, but I can't get it running.
Less is installed via the npm package, I installed it using the packaging system, less itself via Terminal. The first problem I had was that despite a successful installation, Netbeans didn't get to the files he needed (usr/local/), I could either change permissions there, which I don't want to dig into, or change the location. So I changed the location of the .npm and .npm-global folders to my root (home/ivet/), from where Netbeans managed to load it.
So I set everything there, the general settings and the specific project and it looked fine.
I want it to be converted to css automatically after saving, but it throws the message "/usr/bin/env:"node": Directory or file does not exist" and the target css file is still empty.
I found a few advices, basically the same: "ln -s /usr/bin/node/ usr/local/bin/nodejs", but it tells me that the link already exists and nothing will solve it. On closer inspection, I found that the link does exist, but the target file does not exist.
I've also found that installing Nodejs legacy solves this, but this is an older piece of advice, the package no longer exists, and terminal pretends to have the packages that replace this installed. Even when searching for via grep, I couldn't find the file it should link to (neither node nor nodejs).
There are the same tips everywhere that don't work for me and I don't know what to try next. I use Linux Mint 20, but I call myself a Linux BFU, so please write answer step by step :-D
Thanks for the advice
Try completely removing NodeJS & npm and try to install NodeJS using nvm i.e., node version manager.
You can follow this link on how to install nodejs and npm using nvm.
It's always a tedious task sometimes when it comes to package managment with npm, so it's better to go with nvm and I strongly suggest to always have a fallback option for node version when using with or without nvm i.e.,
NodeJS LTS version & NodeJS latest/stable version.
There's also an alternative solution i.e.,you can try switching to yarn package manager.
I've had this issue on Ubuntu and I've resolved it likes this:
First of all I've removed node and npm packages via
sudo aptitude remove node npm
Then I've added the official repositories
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
After which I've just updated the list of packages with sudo aptitude update and then installed Node
sudo aptitude install nodejs npm
And that was it. With these steps done, everything just started to work.

jupyter labextensions install w/o npm

The jupyeter lab documentation (http://ipywidgets.readthedocs.io/en/stable/user_install.html) asks to run the following command to install labextensions:
jupyter labextension install #jupyter-widgets/jupyterlab-manager
I am working behind a corporate firewall and getting node package manager to work properly is very difficult. Is there some other way to predownload labextensions and then do a local install without the need to use an internet connection?
I'm currently exploring if this is possible (as I have a similar server wherein I do not have admin privileges), but in the meantime, perhaps try using NVM (https://github.com/creationix/nvm) to install Node and NPM. This will at least help you get around needing to have root permissions (i.e. sudo).

What are the differences between node.js and node?

I've installed node.js in my machine (linux mint 15), when I run node example.js, it says:
The program 'node' can be found in the following packages:
* node
* nodejs-legacy
Try: sudo apt-get install <selected package>
So what are the differences between node and nodejs? I had both node.js and node installed previously, but when I run node example.js, the web server doesn't start at all. So I deleted node and kept node.js.
The package node is not related to node.js.
nodejs is what you want, however it is arguably better to have the command be called node for compatibility with scripts that use #!/usr/bin/env node.
You can either just create a symlink in your path:
sudo ln -s `which nodejs` /usr/local/bin/node
Or you could install nvm and then use it to install the latest version of node.js:
nvm install stable
I prefer the nvm method, as it allows you to sudo apt-get remove nodejs, and then manage which version of node you're using yourself. You can also have multiple versions of node.js installed and use nvm use <version> to easily switch between them.
I also like to add a line to the bottom my .bashrc like: nvm use stable > /dev/null. That will automatically use the latest version you have installed.
To update your node version to the latest stable: nvm install stable. Every time you do this you will need to install any npm packages that you had installed globally if you want to continue using them.
To switch to an old version just run nvm use <version>, or, if you don't have the old version installed already: nvm install <version>.
This answer is just to tell you the difference between node and nodejs packages on Debian OS.
node
Amateur Packet Radio Node program.
Package details link: https://packages.debian.org/source/wheezy/node
nodejs
Node.js is a platform built on Chrome's JavaScript runtime for easily building fast, scalable network applications. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient, perfect for data-intensive real-time applications that run across distributed devices.
Package details link:
https://packages.debian.org/source/sid/nodejs
There is a simple answer.
Node.JS is the script/code
Node compiles and runs the Node.JS

Should I install node.js on Ubuntu using package manager or from source?

Does anyone know if installing the latest build from source is a risky route to take? Should i just stick with the package manager?
Current recommendations
Use install-node-on-linux if you want a really simple install with your user account (disclaimer: I'm the author).
Use nvm if you want to install with your user account + you need to regularly switch between versions, and you're cool with a little bit of tool and environment complexity.
Follow the directions here to install via the NodeSource PPA. This is easy to do but it's the least flexible.
Old Answer
Note: At the time of this writing I'm using Ubuntu 12.10.
There are a lot of ways to install node. I personally prefer to download the source of the latest stable build and just install it to ~/local (you do this by adding --prefix to the ./configure command as seen here. There really isn't any 'risk' in doing this as everything gets installed in a directory which is separated from the rest of your system. You can have a look at the node recipe in my system install scripts here. I regularly run my update_node.py script to upgrade my installation to the latest version.
Alternatively you can follow the directions here to install the latest stable version via the package manager. I haven't actually done that so I can't comment on how well it works.
What I wouldn't do is install node from the ubuntu universe packages. You'll end up with a very dated version (currently 0.6.19).
update 1/26/2013:
If you are interested in installing node with your user (non-root) account, I highly recommend reading this blog post. I skipped the ~/.npmrc step, but found that the ~/.node_modules symlink step was critial for getting require to work properly.
update 12/30/2014:
I have migrated to using linux mint and doing binary node installs. If you have any interest in writing your own installation scripts, you can find my current one here. Specifically have a look at what I'm doing in node.sh. The execute function is run during the first install so it does things like configure the paths in .bashrc. The install function is run by update-node.sh and is used to remove an existing installation and add a new one (the latest version or one specified by the user).
update 1/8/2016:
I just switched over to using nvm. Simply install the script and then run nvm install node to get the latest version. This seems like an excellent way to get node installed with your user account.
another option is nvm (Node Version Manager) : https://github.com/creationix/nvm
bonus that it lets you easily switch between versions.
Although I live in an .rpm, and not .deb realm, fpm can do both (needs Ruby installed). I have been able to package node.js from the latest stable source without any major difficulties. In your case, the following scenario may help:
./configure --prefix=/usr
make
mkdir -p /tmp/nodejs
make install DESTDIR=/tmp/nodejs
fpm -s dir -t deb -n nodejs -v 0.8.15 -p nodejs-0.8.15.deb -C /tmp/nodejs usr

Resources