Can't install latest NodeJS on Debian Stretch

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I run Debian 9.3. I went to the NodeJS website to see how to install NodeJS v9.X on my machine and ran the code provided.



curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
sudo apt-get install -y nodejs


But the terminal spit out this message:



Reading package lists... Done
Building dependency tree
Reading state information... Done
nodejs is already the newest version (4.8.2~dfsg-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


My machine is stuck with NodeJS v4.8.2 and NPM v1.4.21.



How do I upgrade to the latest NodeJS and NPM?



UPDATE



I followed @GAD3R's instructions. It still installs v4.8.2. Here's what I get after running GAD3R's commands then running sudo apt install nodejs.



Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libuv1
The following NEW packages will be installed:
libuv1 nodejs
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/3,524 kB of archives.
After this operation, 14.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package libuv1:amd64.
(Reading database ... 141225 files and directories currently installed.)
Preparing to unpack .../libuv1_1.9.1-3_amd64.deb ...
Unpacking libuv1:amd64 (1.9.1-3) ...
Selecting previously unselected package nodejs.
Preparing to unpack .../nodejs_4.8.2~dfsg-1_amd64.deb ...
Unpacking nodejs (4.8.2~dfsg-1) ...
Setting up libuv1:amd64 (1.9.1-3) ...
Processing triggers for libc-bin (2.24-11+deb9u1) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up nodejs (4.8.2~dfsg-1) ...
update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode


When I run update-alternatives --config nodejs, the terminal prints update-alternatives: error: no alternatives for nodejs



==



When I run apt-cache policy nodejs, I get this...



nodejs:
Installed: 4.8.2~dfsg-1
Candidate: 4.8.2~dfsg-1
Version table:
9.3.0-1nodesource1 500
500 https://deb.nodesource.com/node_9.x stretch/main amd64 Packages
8.9.3~dfsg-2 1
1 http://ftp.us.debian.org/debian experimental/main amd64 Packages
6.12.0~dfsg-2 500
500 http://ftp.us.debian.org/debian unstable/main amd64 Packages
*** 4.8.2~dfsg-1 990
990 http://ftp.us.debian.org/debian stretch/main amd64 Packages
100 /var/lib/dpkg/status


==



I ran sudo /etc/apt/preferences, which did not exist until now, and wrote this in it:



Package: *
Pin: release n=experimental
Pin-Priority: 100

Package: *
Pin: release n=unstable
Pin-Priority: 100

Package: *
Pin: release n=stable
Pin-Priority: 500


I re-ran the commands from GAD3R's post, but still Debian installed v4.8.2 of nodejs package.







share|improve this question


























    up vote
    3
    down vote

    favorite












    I run Debian 9.3. I went to the NodeJS website to see how to install NodeJS v9.X on my machine and ran the code provided.



    curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
    sudo apt-get install -y nodejs


    But the terminal spit out this message:



    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    nodejs is already the newest version (4.8.2~dfsg-1).
    0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


    My machine is stuck with NodeJS v4.8.2 and NPM v1.4.21.



    How do I upgrade to the latest NodeJS and NPM?



    UPDATE



    I followed @GAD3R's instructions. It still installs v4.8.2. Here's what I get after running GAD3R's commands then running sudo apt install nodejs.



    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    The following additional packages will be installed:
    libuv1
    The following NEW packages will be installed:
    libuv1 nodejs
    0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
    Need to get 0 B/3,524 kB of archives.
    After this operation, 14.5 MB of additional disk space will be used.
    Do you want to continue? [Y/n] y
    Selecting previously unselected package libuv1:amd64.
    (Reading database ... 141225 files and directories currently installed.)
    Preparing to unpack .../libuv1_1.9.1-3_amd64.deb ...
    Unpacking libuv1:amd64 (1.9.1-3) ...
    Selecting previously unselected package nodejs.
    Preparing to unpack .../nodejs_4.8.2~dfsg-1_amd64.deb ...
    Unpacking nodejs (4.8.2~dfsg-1) ...
    Setting up libuv1:amd64 (1.9.1-3) ...
    Processing triggers for libc-bin (2.24-11+deb9u1) ...
    Processing triggers for man-db (2.7.6.1-2) ...
    Setting up nodejs (4.8.2~dfsg-1) ...
    update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode


    When I run update-alternatives --config nodejs, the terminal prints update-alternatives: error: no alternatives for nodejs



    ==



    When I run apt-cache policy nodejs, I get this...



    nodejs:
    Installed: 4.8.2~dfsg-1
    Candidate: 4.8.2~dfsg-1
    Version table:
    9.3.0-1nodesource1 500
    500 https://deb.nodesource.com/node_9.x stretch/main amd64 Packages
    8.9.3~dfsg-2 1
    1 http://ftp.us.debian.org/debian experimental/main amd64 Packages
    6.12.0~dfsg-2 500
    500 http://ftp.us.debian.org/debian unstable/main amd64 Packages
    *** 4.8.2~dfsg-1 990
    990 http://ftp.us.debian.org/debian stretch/main amd64 Packages
    100 /var/lib/dpkg/status


    ==



    I ran sudo /etc/apt/preferences, which did not exist until now, and wrote this in it:



    Package: *
    Pin: release n=experimental
    Pin-Priority: 100

    Package: *
    Pin: release n=unstable
    Pin-Priority: 100

    Package: *
    Pin: release n=stable
    Pin-Priority: 500


    I re-ran the commands from GAD3R's post, but still Debian installed v4.8.2 of nodejs package.







    share|improve this question
























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I run Debian 9.3. I went to the NodeJS website to see how to install NodeJS v9.X on my machine and ran the code provided.



      curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
      sudo apt-get install -y nodejs


      But the terminal spit out this message:



      Reading package lists... Done
      Building dependency tree
      Reading state information... Done
      nodejs is already the newest version (4.8.2~dfsg-1).
      0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


      My machine is stuck with NodeJS v4.8.2 and NPM v1.4.21.



      How do I upgrade to the latest NodeJS and NPM?



      UPDATE



      I followed @GAD3R's instructions. It still installs v4.8.2. Here's what I get after running GAD3R's commands then running sudo apt install nodejs.



      Reading package lists... Done
      Building dependency tree
      Reading state information... Done
      The following additional packages will be installed:
      libuv1
      The following NEW packages will be installed:
      libuv1 nodejs
      0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
      Need to get 0 B/3,524 kB of archives.
      After this operation, 14.5 MB of additional disk space will be used.
      Do you want to continue? [Y/n] y
      Selecting previously unselected package libuv1:amd64.
      (Reading database ... 141225 files and directories currently installed.)
      Preparing to unpack .../libuv1_1.9.1-3_amd64.deb ...
      Unpacking libuv1:amd64 (1.9.1-3) ...
      Selecting previously unselected package nodejs.
      Preparing to unpack .../nodejs_4.8.2~dfsg-1_amd64.deb ...
      Unpacking nodejs (4.8.2~dfsg-1) ...
      Setting up libuv1:amd64 (1.9.1-3) ...
      Processing triggers for libc-bin (2.24-11+deb9u1) ...
      Processing triggers for man-db (2.7.6.1-2) ...
      Setting up nodejs (4.8.2~dfsg-1) ...
      update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode


      When I run update-alternatives --config nodejs, the terminal prints update-alternatives: error: no alternatives for nodejs



      ==



      When I run apt-cache policy nodejs, I get this...



      nodejs:
      Installed: 4.8.2~dfsg-1
      Candidate: 4.8.2~dfsg-1
      Version table:
      9.3.0-1nodesource1 500
      500 https://deb.nodesource.com/node_9.x stretch/main amd64 Packages
      8.9.3~dfsg-2 1
      1 http://ftp.us.debian.org/debian experimental/main amd64 Packages
      6.12.0~dfsg-2 500
      500 http://ftp.us.debian.org/debian unstable/main amd64 Packages
      *** 4.8.2~dfsg-1 990
      990 http://ftp.us.debian.org/debian stretch/main amd64 Packages
      100 /var/lib/dpkg/status


      ==



      I ran sudo /etc/apt/preferences, which did not exist until now, and wrote this in it:



      Package: *
      Pin: release n=experimental
      Pin-Priority: 100

      Package: *
      Pin: release n=unstable
      Pin-Priority: 100

      Package: *
      Pin: release n=stable
      Pin-Priority: 500


      I re-ran the commands from GAD3R's post, but still Debian installed v4.8.2 of nodejs package.







      share|improve this question














      I run Debian 9.3. I went to the NodeJS website to see how to install NodeJS v9.X on my machine and ran the code provided.



      curl -sL https://deb.nodesource.com/setup_9.x | sudo -E bash -
      sudo apt-get install -y nodejs


      But the terminal spit out this message:



      Reading package lists... Done
      Building dependency tree
      Reading state information... Done
      nodejs is already the newest version (4.8.2~dfsg-1).
      0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


      My machine is stuck with NodeJS v4.8.2 and NPM v1.4.21.



      How do I upgrade to the latest NodeJS and NPM?



      UPDATE



      I followed @GAD3R's instructions. It still installs v4.8.2. Here's what I get after running GAD3R's commands then running sudo apt install nodejs.



      Reading package lists... Done
      Building dependency tree
      Reading state information... Done
      The following additional packages will be installed:
      libuv1
      The following NEW packages will be installed:
      libuv1 nodejs
      0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
      Need to get 0 B/3,524 kB of archives.
      After this operation, 14.5 MB of additional disk space will be used.
      Do you want to continue? [Y/n] y
      Selecting previously unselected package libuv1:amd64.
      (Reading database ... 141225 files and directories currently installed.)
      Preparing to unpack .../libuv1_1.9.1-3_amd64.deb ...
      Unpacking libuv1:amd64 (1.9.1-3) ...
      Selecting previously unselected package nodejs.
      Preparing to unpack .../nodejs_4.8.2~dfsg-1_amd64.deb ...
      Unpacking nodejs (4.8.2~dfsg-1) ...
      Setting up libuv1:amd64 (1.9.1-3) ...
      Processing triggers for libc-bin (2.24-11+deb9u1) ...
      Processing triggers for man-db (2.7.6.1-2) ...
      Setting up nodejs (4.8.2~dfsg-1) ...
      update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in auto mode


      When I run update-alternatives --config nodejs, the terminal prints update-alternatives: error: no alternatives for nodejs



      ==



      When I run apt-cache policy nodejs, I get this...



      nodejs:
      Installed: 4.8.2~dfsg-1
      Candidate: 4.8.2~dfsg-1
      Version table:
      9.3.0-1nodesource1 500
      500 https://deb.nodesource.com/node_9.x stretch/main amd64 Packages
      8.9.3~dfsg-2 1
      1 http://ftp.us.debian.org/debian experimental/main amd64 Packages
      6.12.0~dfsg-2 500
      500 http://ftp.us.debian.org/debian unstable/main amd64 Packages
      *** 4.8.2~dfsg-1 990
      990 http://ftp.us.debian.org/debian stretch/main amd64 Packages
      100 /var/lib/dpkg/status


      ==



      I ran sudo /etc/apt/preferences, which did not exist until now, and wrote this in it:



      Package: *
      Pin: release n=experimental
      Pin-Priority: 100

      Package: *
      Pin: release n=unstable
      Pin-Priority: 100

      Package: *
      Pin: release n=stable
      Pin-Priority: 500


      I re-ran the commands from GAD3R's post, but still Debian installed v4.8.2 of nodejs package.









      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 25 '17 at 19:46

























      asked Dec 25 '17 at 17:00









      Username

      2801415




      2801415




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          The 4.8.2 version is installed through apt from the main repo.



          run:



          apt purge nodejs
          apt install lsb-release
          apt install -y nodejs


          Verify the installed nodjs version:



          node --version
          v9.3.0


          The npm version:



          npm --version
          5.5.1


          The problem come from the pin priority , pin the stable release to 500



          Package: *
          Pin: release n=experimental
          Pin-Priority: 100


          Unstable:



          Package: *
          Pin: release n=unstable
          Pin-Priority: 100


          And the stable:



          Package: *
          Pin: release n=stable
          Pin-Priority: 500





          share|improve this answer






















          • Still gives me the same nodejs version, but no npm.
            – Username
            Dec 25 '17 at 17:37










          • @Username can you add the output of update-alternatives --config nodejs to the question , please.
            – GAD3R
            Dec 25 '17 at 17:39






          • 1




            Running that command, the terminal prints "update-alternatives: error: no alternatives for nodejs"
            – Username
            Dec 25 '17 at 17:42











          • @Username Please check your Pin-Priority , maybe it is configured to install the packages from the stable release. please add the output of apt-cache policy nodejs
            – GAD3R
            Dec 25 '17 at 17:49











          • Added the output to my question
            – Username
            Dec 25 '17 at 17:53










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );








           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f412984%2fcant-install-latest-nodejs-on-debian-stretch%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          3
          down vote



          accepted










          The 4.8.2 version is installed through apt from the main repo.



          run:



          apt purge nodejs
          apt install lsb-release
          apt install -y nodejs


          Verify the installed nodjs version:



          node --version
          v9.3.0


          The npm version:



          npm --version
          5.5.1


          The problem come from the pin priority , pin the stable release to 500



          Package: *
          Pin: release n=experimental
          Pin-Priority: 100


          Unstable:



          Package: *
          Pin: release n=unstable
          Pin-Priority: 100


          And the stable:



          Package: *
          Pin: release n=stable
          Pin-Priority: 500





          share|improve this answer






















          • Still gives me the same nodejs version, but no npm.
            – Username
            Dec 25 '17 at 17:37










          • @Username can you add the output of update-alternatives --config nodejs to the question , please.
            – GAD3R
            Dec 25 '17 at 17:39






          • 1




            Running that command, the terminal prints "update-alternatives: error: no alternatives for nodejs"
            – Username
            Dec 25 '17 at 17:42











          • @Username Please check your Pin-Priority , maybe it is configured to install the packages from the stable release. please add the output of apt-cache policy nodejs
            – GAD3R
            Dec 25 '17 at 17:49











          • Added the output to my question
            – Username
            Dec 25 '17 at 17:53














          up vote
          3
          down vote



          accepted










          The 4.8.2 version is installed through apt from the main repo.



          run:



          apt purge nodejs
          apt install lsb-release
          apt install -y nodejs


          Verify the installed nodjs version:



          node --version
          v9.3.0


          The npm version:



          npm --version
          5.5.1


          The problem come from the pin priority , pin the stable release to 500



          Package: *
          Pin: release n=experimental
          Pin-Priority: 100


          Unstable:



          Package: *
          Pin: release n=unstable
          Pin-Priority: 100


          And the stable:



          Package: *
          Pin: release n=stable
          Pin-Priority: 500





          share|improve this answer






















          • Still gives me the same nodejs version, but no npm.
            – Username
            Dec 25 '17 at 17:37










          • @Username can you add the output of update-alternatives --config nodejs to the question , please.
            – GAD3R
            Dec 25 '17 at 17:39






          • 1




            Running that command, the terminal prints "update-alternatives: error: no alternatives for nodejs"
            – Username
            Dec 25 '17 at 17:42











          • @Username Please check your Pin-Priority , maybe it is configured to install the packages from the stable release. please add the output of apt-cache policy nodejs
            – GAD3R
            Dec 25 '17 at 17:49











          • Added the output to my question
            – Username
            Dec 25 '17 at 17:53












          up vote
          3
          down vote



          accepted







          up vote
          3
          down vote



          accepted






          The 4.8.2 version is installed through apt from the main repo.



          run:



          apt purge nodejs
          apt install lsb-release
          apt install -y nodejs


          Verify the installed nodjs version:



          node --version
          v9.3.0


          The npm version:



          npm --version
          5.5.1


          The problem come from the pin priority , pin the stable release to 500



          Package: *
          Pin: release n=experimental
          Pin-Priority: 100


          Unstable:



          Package: *
          Pin: release n=unstable
          Pin-Priority: 100


          And the stable:



          Package: *
          Pin: release n=stable
          Pin-Priority: 500





          share|improve this answer














          The 4.8.2 version is installed through apt from the main repo.



          run:



          apt purge nodejs
          apt install lsb-release
          apt install -y nodejs


          Verify the installed nodjs version:



          node --version
          v9.3.0


          The npm version:



          npm --version
          5.5.1


          The problem come from the pin priority , pin the stable release to 500



          Package: *
          Pin: release n=experimental
          Pin-Priority: 100


          Unstable:



          Package: *
          Pin: release n=unstable
          Pin-Priority: 100


          And the stable:



          Package: *
          Pin: release n=stable
          Pin-Priority: 500






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 25 '17 at 18:40

























          answered Dec 25 '17 at 17:16









          GAD3R

          22.5k154894




          22.5k154894











          • Still gives me the same nodejs version, but no npm.
            – Username
            Dec 25 '17 at 17:37










          • @Username can you add the output of update-alternatives --config nodejs to the question , please.
            – GAD3R
            Dec 25 '17 at 17:39






          • 1




            Running that command, the terminal prints "update-alternatives: error: no alternatives for nodejs"
            – Username
            Dec 25 '17 at 17:42











          • @Username Please check your Pin-Priority , maybe it is configured to install the packages from the stable release. please add the output of apt-cache policy nodejs
            – GAD3R
            Dec 25 '17 at 17:49











          • Added the output to my question
            – Username
            Dec 25 '17 at 17:53
















          • Still gives me the same nodejs version, but no npm.
            – Username
            Dec 25 '17 at 17:37










          • @Username can you add the output of update-alternatives --config nodejs to the question , please.
            – GAD3R
            Dec 25 '17 at 17:39






          • 1




            Running that command, the terminal prints "update-alternatives: error: no alternatives for nodejs"
            – Username
            Dec 25 '17 at 17:42











          • @Username Please check your Pin-Priority , maybe it is configured to install the packages from the stable release. please add the output of apt-cache policy nodejs
            – GAD3R
            Dec 25 '17 at 17:49











          • Added the output to my question
            – Username
            Dec 25 '17 at 17:53















          Still gives me the same nodejs version, but no npm.
          – Username
          Dec 25 '17 at 17:37




          Still gives me the same nodejs version, but no npm.
          – Username
          Dec 25 '17 at 17:37












          @Username can you add the output of update-alternatives --config nodejs to the question , please.
          – GAD3R
          Dec 25 '17 at 17:39




          @Username can you add the output of update-alternatives --config nodejs to the question , please.
          – GAD3R
          Dec 25 '17 at 17:39




          1




          1




          Running that command, the terminal prints "update-alternatives: error: no alternatives for nodejs"
          – Username
          Dec 25 '17 at 17:42





          Running that command, the terminal prints "update-alternatives: error: no alternatives for nodejs"
          – Username
          Dec 25 '17 at 17:42













          @Username Please check your Pin-Priority , maybe it is configured to install the packages from the stable release. please add the output of apt-cache policy nodejs
          – GAD3R
          Dec 25 '17 at 17:49





          @Username Please check your Pin-Priority , maybe it is configured to install the packages from the stable release. please add the output of apt-cache policy nodejs
          – GAD3R
          Dec 25 '17 at 17:49













          Added the output to my question
          – Username
          Dec 25 '17 at 17:53




          Added the output to my question
          – Username
          Dec 25 '17 at 17:53












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f412984%2fcant-install-latest-nodejs-on-debian-stretch%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)