我要安装节点版本 10.16.3
- 所以我正在尝试使用 nvm 安装,但我的节点 js 向我显示了这个错误
Command 'nodejs' not found, but can be installed with:
sudo apt install nodejs
我已经安装了nodejs我仍然收到这个错误
问题类似于https://stackoverflow.com/questions/11177954/how-do-i-completely-uninstall-node-js-and-reinstall-from-beginning-mac-os-x但对于 Ubuntu,主要是涉及清理部分。
安装照常由: 完成sudo apt-get install node
,但是我后来使用该npm
命令以多个用户的身份安装多个软件包。
如何完全删除 npm 以及 npm 在我的系统上安装的所有库、包和任何其他文件,例如npm install -g @vue/cli
?我可能不得不从 卸载apt
,但主要问题与所做的所有更改有关npm
。
笔记:
编辑提醒未来的自己和他人:对于没有 sudo 的重新安装,可以在此处找到带有食谱的链接。我仍然不清楚什么是最好的,但另一方面https://stackoverflow.com/questions/10081293/install-npm-into-home-directory-with-distribution-nodejs-package-ubuntu有README.md# debinstall所以可能使用 apt 安装节点,然后使用前缀...
我有节点并nodejs
安装在我的 Ubuntu 18.04 机器上。我想删除它和/或重新安装它以获得最新nodejs
版本。
node -v
它给我:v12.18.4
nodejs -v
它给我:v8.10.0
还
which node
返回/usr/local/bin/node
which nodejs
返回/usr/bin/nodejs
我试图卸载它们
sudo apt-get --purge remove node
sudo apt-get --purge remove nodejs
但sudo apt-get --purge remove node
给了我
E: Unable to locate package node
并sudo apt-get --purge remove nodejs
返回
npm : Depends: nodejs but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
有什么解决办法吗?
我对 Ubuntu 很陌生。我可以将 Node.js 安装到最新版本 14.7.0 但我正在使用的程序(Jhipster)告诉我需要安装长期支持(LTS,目前是 12.18.3)并且不知道如何去做吧。
Windows中有一个node-v12.18.3-linux-x64.tar.xz文件,看起来像一个zip文件,但我不知道如何安装它(文件管理器打开时它不会自行安装)
我试图用谷歌搜索如何选择版本,但我可以找到如何去做。请为傻瓜解释一下。谢谢。
我在我的 Ubuntu 上安装了 Nodejs:
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
使用以下命令:
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
结果是:
$ nodejs -v
v4.2.6
在互联网上,我看到有很多更新的版本https://nodejs.org/en/download/releases/。所以,
谢谢!
我正在尝试安装 npm 并找到了这个解决方案。我跑aptitude install npm
了,建议的解决方案是
The following packages have unmet dependencies:
libssl-dev : Depends: libssl1.1 (= 1.1.1f-1ubuntu2)
but 1.1.1g-1+ubuntu18.04.1+deb.sury.org+1 is installed
Keep the following packages at their current version:
1) libnode-dev [Not Installed]
2) libssl-dev [Not Installed]
3) node-gyp [Not Installed]
4) npm [Not Installed]
Accept this solution? [Y/n/q/?]
它基本上是在建议降级,但是如果我将 libssl1.1 降级到 libssl1.0 会对我的系统产生什么影响?
编辑:将 Ubuntu 18.04 升级到 20.04 后出现此问题。Dan Scally的解决方案有效,我还在启动板的评论中提供了另一个选项,其中针对我的特定情况提供了更详细的信息。
Err:37 http://archive.ubuntu.com/ubuntu focal/main DEP-11 64x64 Icons
Hash Sum mismatch
Hashes of expected file:
- Filesize:162899 [weak]
- SHA256:9f4ffba2a05dc2fb76857d4b30ed55724fe6e2999341694f2b86940ab067a44b
- SHA1:f470f9b518e5cd213a66334f3a5e3b671c4dbe61 [weak]
- MD5Sum:504d24e4682a64a0559d13f7cf1e5ca6 [weak]
Hashes of received file:
- SHA256:0d49809352ede8d21c648de700d0d16fe10c2394064b1bc457331e0565419e3a
- SHA1:fd8bebb3573711be3d667718e13250cd7ae6b629 [weak]
- MD5Sum:747cd4f065cae49a271e9b46cc88c6d6 [weak]
- Filesize:162899 [weak]
Last modification reported: Mon, 20 Apr 2020 09:35:48 +0000
Release file created at: Thu, 23 Apr 2020 17:33:17 +0000
.
.
.
.
.
.
.
E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/main/dep11/by-hash/SHA256/9f4ffba2a05dc2fb76857d4b30ed55724fe6e2999341694f2b86940ab067a44b Hash Sum mismatch
Hashes of expected file:
- Filesize:162899 [weak]
- SHA256:9f4ffba2a05dc2fb76857d4b30ed55724fe6e2999341694f2b86940ab067a44b
- SHA1:f470f9b518e5cd213a66334f3a5e3b671c4dbe61 [weak]
- MD5Sum:504d24e4682a64a0559d13f7cf1e5ca6 [weak]
Hashes of received file:
- SHA256:0d49809352ede8d21c648de700d0d16fe10c2394064b1bc457331e0565419e3a
- SHA1:fd8bebb3573711be3d667718e13250cd7ae6b629 [weak]
- MD5Sum:747cd4f065cae49a271e9b46cc88c6d6 [weak]
- Filesize:162899 [weak]
Last modification reported: Mon, 20 Apr 2020 09:35:48 +0000
Release file created at: Thu, 23 Apr 2020 17:33:17 +0000
E: Some index files failed to download. They have been ignored, or old ones used instead.
我已经尝试了其他答案中提供的所有可能的解决方案,但问题仍然存在。我正在使用 ubuntu 20.04。我是 Linux 环境的新手,所以我对 Linux 系统和术语了解不多。
我试图安装节点 js 和 npm。我在使用 apt-get 时遇到了很多问题。
问题:
使用 apt-get 安装后找不到 npm 命令
Command 'npm' not found, did you mean:
command 'apm' from snap atom (1.48.0)
command 'nsm' from snap nift (2.3.10)
See 'snap info <snapname>' for additional versions.
当我尝试安装sudo apt-get install python-software-properties
我有,
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
python-software-properties : Depends: python (>= 2.7) but it is not going to be installed
Depends: python (< 2.8) but it is not going to be installed
Depends: python-apt (>= 0.6.20ubuntu16) but it is not going to be installed
Depends: python-pycurl but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
当我尝试使用单独安装 npm 时apt-get npm
The following packages have unmet dependencies:
npm : Depends: node-gyp (>= 0.10.9) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
我正在尝试使用 systemd 服务设置服务,但出现错误,我无法理解它有什么问题。
[Unit]
Description=Vinematik Service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=buraksumer13
ExecStart=/home/buraksumer13/.nvm/versions/node/v14.2.0/bin node home/buraksumer13/Documents/vinematikIns/index.js
[Install]
WantedBy=multi-user.target
运行时出现以下错误systemctl status vinematik
:
● vinematik.service - Vinematik Service
Loaded: loaded (/etc/systemd/system/vinematik.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Wed 2020-05-06 16:44:12 UTC; 788ms ago
Process: 2981 ExecStart=/home/buraksumer13/.nvm/versions/node/v14.2.0/bin node /home/buraksumer13/Documents/vinematikIns/index.js (code=exited, status=203/EXEC)
Main PID: 2981 (code=exited, status=203/EXEC)
我不明白为什么它不能启动我的脚本,我也不太确定这是否是一个错误。但我确实认为这可能与我的ExecStart
生产线有关,是设置正确还是我做错了什么?
提前致谢 :)