-1

I have downloaded Nodejs in my Linux VM from nodejs.org, I want to install it from terminal. VM have node v0.12.18 manually installed by someone else, I don't know how to do that. As I am installing nodejs offline, I should not depend on that whether or not npm installed.

I have tried npm install node-v15.6.0-linux-x64.tar.gz

Getting below error

sudo npm install node-v15.6.0-linux-x64.tar.gz
npm WARN excluding symbolic link bin/npm -> ../lib/node_modules/npm/bin/npm-cli.                                                                                        js
npm WARN excluding symbolic link bin/npx -> ../lib/node_modules/npm/bin/npx-cli.                                                                                        js
npm ERR! addLocal Could not install /home/usermachinename/node-v15.6.0-linux-x64.tar.g                                                                                        z
npm ERR! Linux 3.10.0-1062.9.1.el7.x86_64
npm ERR! argv "/usr/local/lib/nodejs/node-v0.12.18-linux-x64/bin/node" "/usr/loc                                                                                        al/lib/nodejs/node-v0.12.18-linux-x64/bin/npm" "install" "node-v15.6.0-linux-x64                                                                                        .tar.gz"
npm ERR! node v0.12.18
npm ERR! npm  v2.15.11
npm ERR! path /tmp/npm-1637-a9cb4311/unpack-5a7f411732fb/package.json
npm ERR! code ENOENT
npm ERR! errno -2

npm ERR! enoent ENOENT, open '/tmp/npm-1637-a9cb4311/unpack-5a7f411732fb/package                                                                                        .json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     /home/usermachinename/npm-debug.log

How can I fix this?

8
  • When you say that "this is not working" what happens? What didn't happen? Did you get any errors - what were they? From where did you download nodejsfilename.tar.gz? Is npm even installed? Commented Jan 18, 2021 at 12:45
  • 2
    Is this question materially different to your earlier related questions tar.unpack untar error while installing angular in Linux vm or even How to install nodejs in linux vm if wget is not working? Commented Jan 18, 2021 at 12:46
  • 1
    @roaima - This is different/new question. Please check my updated question. Apologies for not posting all the information. I have downloaded this file from nodejs.org Commented Jan 18, 2021 at 12:55
  • How to install Node.js via binary archive on Linux (linked from nodejs.org/en/download/current/). Commented Jan 18, 2021 at 12:59
  • 3
    Don't try to work around the proxy restrictions - that'll only come back and hurt you later. Get them fixed properly (and officially, if working on company purposes) Commented Jan 18, 2021 at 13:32

1 Answer 1

2

If you're going to install NodeJS you need to follow the installation instructions

This is wrong:

npm install node-v15.6.0-linux-x64.tar.gz

The best option may be simply to use the version packaged for your Linux distribution.

However, if you really want to do it yourself, the download page has installation instructions, which explains that for a tar archive such as this you simply unpack it into the target directory.

For example,

VERSION=v15.6.0
DISTRO=linux-x64
sudo mkdir -p /usr/local/lib/nodejs
sudo tar -xJvf node-$VERSION-$DISTRO.tar.xz -C /usr/local/lib/nodejs

Then set the environment variables and add this to ~/.profile or ~/.bash_profile

# Nodejs
VERSION=v15.6.0
DISTRO=linux-x64
export PATH=/usr/local/lib/nodejs/node-$VERSION-$DISTRO/bin:$PATH
2
  • I am getting this error tar xf node-v15.6.0-linux-x64.tar.gz /usr/local/lib/ tar: /usr/local/lib: Not found in archive tar: Exiting with failure status due to previous errors Commented Jan 18, 2021 at 18:07
  • That's because you're not following the instructions correctly Commented Jan 18, 2021 at 18:51

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.