首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法安装最新版本的nodejs。我试着安装NodeJS17.x

无法安装最新版本的nodejs。我试着安装NodeJS17.x
EN

Stack Overflow用户
提问于 2022-07-06 05:48:44
回答 3查看 828关注 0票数 -1

I正在尝试安装NodeJS17.x,但我最终安装了NodeJS10.19。@ OS :Ubuntu20.04.4 LTS x86_64 shell : fish shell

请帮忙..。我需要为我的项目安装最新版本的npm,但由于这个问题,我被困住了:(我认为curl没有正常工作。我不太了解linux.

代码语言:javascript
复制
    $ cd ~
    $ curl -sL https://deb.nodesource.com/setup_17.x -o nodesource_setup.sh
    
    $ sudo bash nodesource_setup.sh

    ## Installing the NodeSource Node.js 17.x repo...
    
    
    ## Populating apt-get cache...
    
    + apt-get update
    Ign:1 https://repo.nordvpn.com/deb/nordvpn/debian stable InRelease
    Hit:2 http://dl.winehq.org/wine-builds/ubuntu focal InRelease                                                                                                                          
    Hit:3 http://in.archive.ubuntu.com/ubuntu focal InRelease                                                                                                                              
    Err:4 https://repo.nordvpn.com/deb/nordvpn/debian stable Release                                                                                                                       
      Could not handshake: Error in the pull function. [IP: 104.17.49.74 443]
    Hit:5 http://in.archive.ubuntu.com/ubuntu focal-updates InRelease                                                                                                                      
    Get:6 http://repo.mysql.com/apt/ubuntu focal InRelease [12.9 kB]                                                                                                                       
    Get:7 https://packages.microsoft.com/repos/edge stable InRelease [7,342 B]                                                                                                             
    Hit:8 http://in.archive.ubuntu.com/ubuntu focal-backports InRelease                                                                                                               
    Hit:9 http://ppa.launchpad.net/audio-recorder/ppa/ubuntu focal InRelease                                                                       
    Hit:10 https://deb.opera.com/opera-stable stable InRelease                                                                     
    Get:11 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]                                                     
    Err:6 http://repo.mysql.com/apt/ubuntu focal InRelease                                                               
      The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 467B942D3A79BD29
    Err:7 https://packages.microsoft.com/repos/edge stable InRelease                                                     
      The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
    Hit:12 http://ppa.launchpad.net/ethereum/ethereum/ubuntu focal InRelease                                             
    Hit:13 http://ppa.launchpad.net/fish-shell/release-3/ubuntu focal InRelease                                          
    Hit:14 http://ppa.launchpad.net/gencfsm/ppa/ubuntu focal InRelease                 
    Hit:15 https://dl.google.com/linux/chrome/deb stable InRelease                     
    Reading package lists... Done   
    E: The repository 'https://repo.nordvpn.com/deb/nordvpn/debian stable Release' does not have a Release file.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://repo.mysql.com/apt/ubuntu focal InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 467B942D3A79BD29
    W: GPG error: https://packages.microsoft.com/repos/edge stable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EB3E94ADBE1229CF
    E: The repository 'https://packages.microsoft.com/repos/edge stable InRelease' is not signed.
    N: Updating from such a repository can't be done securely, and is therefore disabled by default.
    N: See apt-secure(8) manpage for repository creation and user configuration details.
    Error executing command, exiting
    
    $ sudo apt install nodejs
    
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    The following packages were automatically installed and are no longer required:
      cmake-data libevent-2.1-7 libjsoncpp1 libnatpmp1 librhash0 transmission-common
    Use 'sudo apt autoremove' to remove them.
    Suggested packages:
      npm
    The following NEW packages will be installed:
      nodejs
    0 upgraded, 1 newly installed, 0 to remove and 24 not upgraded.
    Need to get 0 B/61.1 kB of archives.
    After this operation, 158 kB of additional disk space will be used.
    Selecting previously unselected package nodejs.
    (Reading database ... 284202 files and directories currently installed.)
    Preparing to unpack .../nodejs_10.19.0~dfsg-3ubuntu1_amd64.deb ...
    Unpacking nodejs (10.19.0~dfsg-3ubuntu1) ...
    Setting up nodejs (10.19.0~dfsg-3ubuntu1) ...
    update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode
    Processing triggers for man-db (2.9.1-1) ...
    
    $ node -v
    
    v10.19.0
EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2022-07-06 06:22:18

我建议您使用nvm安装和管理node.js版本。

在Ubuntu 检查文档的这一部分上安装nvm

这样就可以方便地安装/切换不同版本的节点。

代码语言:javascript
复制
# nvm install <node_version>
$ nvm install 12

# nvm use <node_version>
$ nvm use 12
票数 1
EN

Stack Overflow用户

发布于 2022-07-06 05:55:19

你试过先删除最新的更新吗?试一试

代码语言:javascript
复制
sudo apt -y update && sudo apt -y upgrade
curl -sL https://deb.nodesource.com/setup_17.x | sudo bash -
sudo apt-get install -y nodejs

如果这管用的话!附注:sudo就像windows中的管理用户。你也需要有超级用户密码!

票数 0
EN

Stack Overflow用户

发布于 2022-11-03 10:58:25

这也发生在我身上。我遵循这里的建议,https://askubuntu.com/questions/1141035/error-executing-command-exiting

代码语言:javascript
复制
# Remove the current installed nodejs
sudo apt-get purge nodejs*

# Remove every other apt sources
sudo rm -rf /var/lib/apt/lists/* 
sudo rm -rf /etc/apt/sources.list.d/* 
sudo apt-get update 

# Add the nodejs repository again
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -  
sudo apt-get install -y nodejs
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72878479

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档