在Ubuntu桌面上安装带有下载的二进制文件的Node.js.文件在哪里? [英] Install Node.js with downloaded binary on Ubuntu Desktop.. Where do the files go?

查看:126
本文介绍了在Ubuntu桌面上安装带有下载的二进制文件的Node.js.文件在哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经直接从 https://nodejs.org/en/下载了Node.js到我的Ubuntu桌面操作系统.我可以轻松地将node-vX.X.0-linux-x64.tar.xz文件解包,并且可以看到节点目录:bin,include,lib,share.我猜我的下载文件夹~/Downloads/node-vX.X.0-linux-x64不会是最终的安装位置.

I've downloaded Node.js directly from https://nodejs.org/en/ onto my Ubuntu Desktop operating system. I can easily unpackage the node-vX.X.0-linux-x64.tar.xz file, and I can see node directories: bin, include, lib, share. I'm guessing my download folder, ~/Downloads/node-vX.X.0-linux-x64, is not going to be the final installation location.

我的猜测是将所有目录复制到/usr/bin/node/node-vX.X.-linux-x64,但是我不确定.

My guess would be to copy all of the directory over to /usr/bin/node/node-vX.X.-linux-x64 but I'm not really sure.

这些文件在哪里? (我已经尝试过下载文件中的readme.md文件以及该站点上的文档.我本以为在nodejs.org上的某个地方会提供一些帮助...)

Where do these files go? (I've tried the readme.md file in the download and the docs on that site. I would have thought something, somewhere on nodejs.org would have offered a bit of help...)

这里是否需要特殊的安装步骤?

Is there a special installation step required here?

推荐答案

我编写了一个教程来完全按照您的要求进行操作:如何在Linux上获取Node 6.7.0 - 关于Node 6.7.0,但您只能更改版本号.

I wrote a tutorial to do exactly what you're asking: How to get Node 6.7.0 on Linux - it's about Node 6.7.0 but you can just change the version number.

简而言之:

# If you have a 64-bit system then download binary package:
wget https://nodejs.org/dist/v6.7.0/node-v6.7.0-linux-x64.tar.gz

# If you have a 32-bit system then download a different version:
wget https://nodejs.org/dist/v6.7.0/node-v6.7.0-linux-x86.tar.gz

提取:

# Extract what you downloaded:
tar xzvf node-v6.7.0-linux-x64.tar.gz

# Change the file ownership:
sudo chown -Rv root.root node-v6.7.0-linux-x64

然后在以下位置之一安装:

# Install files in /usr/local
sudo cp -Rvi node-v6.7.0-linux-x64/{bin,include,lib,share} /usr/local
# (change -Rvi to -Rvf if you want to overwrite existing files)

# Install files in /opt/node
sudo cp -Rvi node-v6.7.0-linux-x64 /opt/node

# Install files in /opt/node-6.7.0
sudo cp -Rvi node-v6.7.0-linux-x64 /opt/node-6.7.0

本文中将更好地说明示例中这3个位置之间的区别.其后果主要与PATH和安装多个版本有关.

The difference between those 3 locations in the example is explained better in the article. The consequences are mostly related to PATH and installing multiple versions.

您需要确保PATH中有nodenpm二进制文件所在的目录.有关如何执行此操作的详细信息,请参见我的教程.

You need to make sure that directory where you have the node and npm binaries is in your PATH. See my tutorial for details on how to do that.

从二进制文件安装的Node中npm的shebang行不同于从源文件安装的.如果您有时间,这就是我建议从源代码进行构建的原因之一.另一个原因是,从源代码进行安装可以执行make test来测试特定系统上Node的版本,而从二进制文件或使用nvm进行安装时则无法执行.

The shebang line of npm in Node installed from binaries is different than when installed from sources. This is one of the reasons I recommand building from sources if you have time for that. The other reason is that installing from sources you can do make test to test the version of Node on your specific system, which you cannot do when installing from binaries or with nvm.

这篇关于在Ubuntu桌面上安装带有下载的二进制文件的Node.js.文件在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆