NPM is incorrect version on latest Ubuntu (18.04) installation

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








up vote
0
down vote

favorite
1












Normal installation would be sudo apt install nodejs to install Node.js and then sudo apt install npm to install Node Package Manager. However, upon doing so, npm -v says 3.5.2. To upgrade normally, I would do sudo npm install -g npm, which updates to the latest version (which, at the time of writing this article, is 6.0.1).



When I do a which npm, I get /usr/local/bin/npm, however apt installs a symlink at /usr/bin/npm. If I sudo apt purge npm to remove npm, it still leaves the npm version of npm at /usr/local/bin/npm, however npm -v says -bash: /usr/bin/npm: No such file or directory.



Many articles say to use a PPA to install nodejs, but I think there should be a native way to do this through apt.



DigitalOcean instructions on installation normally and through PPA: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-18-04



TecAdmin instructions on installation through PPA: https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/







share|improve this question
























    up vote
    0
    down vote

    favorite
    1












    Normal installation would be sudo apt install nodejs to install Node.js and then sudo apt install npm to install Node Package Manager. However, upon doing so, npm -v says 3.5.2. To upgrade normally, I would do sudo npm install -g npm, which updates to the latest version (which, at the time of writing this article, is 6.0.1).



    When I do a which npm, I get /usr/local/bin/npm, however apt installs a symlink at /usr/bin/npm. If I sudo apt purge npm to remove npm, it still leaves the npm version of npm at /usr/local/bin/npm, however npm -v says -bash: /usr/bin/npm: No such file or directory.



    Many articles say to use a PPA to install nodejs, but I think there should be a native way to do this through apt.



    DigitalOcean instructions on installation normally and through PPA: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-18-04



    TecAdmin instructions on installation through PPA: https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/







    share|improve this question






















      up vote
      0
      down vote

      favorite
      1









      up vote
      0
      down vote

      favorite
      1






      1





      Normal installation would be sudo apt install nodejs to install Node.js and then sudo apt install npm to install Node Package Manager. However, upon doing so, npm -v says 3.5.2. To upgrade normally, I would do sudo npm install -g npm, which updates to the latest version (which, at the time of writing this article, is 6.0.1).



      When I do a which npm, I get /usr/local/bin/npm, however apt installs a symlink at /usr/bin/npm. If I sudo apt purge npm to remove npm, it still leaves the npm version of npm at /usr/local/bin/npm, however npm -v says -bash: /usr/bin/npm: No such file or directory.



      Many articles say to use a PPA to install nodejs, but I think there should be a native way to do this through apt.



      DigitalOcean instructions on installation normally and through PPA: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-18-04



      TecAdmin instructions on installation through PPA: https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/







      share|improve this question












      Normal installation would be sudo apt install nodejs to install Node.js and then sudo apt install npm to install Node Package Manager. However, upon doing so, npm -v says 3.5.2. To upgrade normally, I would do sudo npm install -g npm, which updates to the latest version (which, at the time of writing this article, is 6.0.1).



      When I do a which npm, I get /usr/local/bin/npm, however apt installs a symlink at /usr/bin/npm. If I sudo apt purge npm to remove npm, it still leaves the npm version of npm at /usr/local/bin/npm, however npm -v says -bash: /usr/bin/npm: No such file or directory.



      Many articles say to use a PPA to install nodejs, but I think there should be a native way to do this through apt.



      DigitalOcean instructions on installation normally and through PPA: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-18-04



      TecAdmin instructions on installation through PPA: https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/









      share|improve this question











      share|improve this question




      share|improve this question










      asked May 14 at 21:14









      Blairg23

      1258




      1258




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote













          The way I found is to purge npm through sudo apt purge npm, then simply recreate a symlink to the global installation via ln -s /usr/local/bin/npm /usr/bin/npm. After that fix, npm -v returns 6.0.1 as expected.






          share|improve this answer




















          • Worked with Ubuntu 18.04 running through UserLAnd on Android 6.0.1. Thank you! :)
            – l3l_aze
            Aug 26 at 8:58










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "89"
          ;
          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: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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%2faskubuntu.com%2fquestions%2f1036278%2fnpm-is-incorrect-version-on-latest-ubuntu-18-04-installation%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
          2
          down vote













          The way I found is to purge npm through sudo apt purge npm, then simply recreate a symlink to the global installation via ln -s /usr/local/bin/npm /usr/bin/npm. After that fix, npm -v returns 6.0.1 as expected.






          share|improve this answer




















          • Worked with Ubuntu 18.04 running through UserLAnd on Android 6.0.1. Thank you! :)
            – l3l_aze
            Aug 26 at 8:58














          up vote
          2
          down vote













          The way I found is to purge npm through sudo apt purge npm, then simply recreate a symlink to the global installation via ln -s /usr/local/bin/npm /usr/bin/npm. After that fix, npm -v returns 6.0.1 as expected.






          share|improve this answer




















          • Worked with Ubuntu 18.04 running through UserLAnd on Android 6.0.1. Thank you! :)
            – l3l_aze
            Aug 26 at 8:58












          up vote
          2
          down vote










          up vote
          2
          down vote









          The way I found is to purge npm through sudo apt purge npm, then simply recreate a symlink to the global installation via ln -s /usr/local/bin/npm /usr/bin/npm. After that fix, npm -v returns 6.0.1 as expected.






          share|improve this answer












          The way I found is to purge npm through sudo apt purge npm, then simply recreate a symlink to the global installation via ln -s /usr/local/bin/npm /usr/bin/npm. After that fix, npm -v returns 6.0.1 as expected.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 14 at 21:14









          Blairg23

          1258




          1258











          • Worked with Ubuntu 18.04 running through UserLAnd on Android 6.0.1. Thank you! :)
            – l3l_aze
            Aug 26 at 8:58
















          • Worked with Ubuntu 18.04 running through UserLAnd on Android 6.0.1. Thank you! :)
            – l3l_aze
            Aug 26 at 8:58















          Worked with Ubuntu 18.04 running through UserLAnd on Android 6.0.1. Thank you! :)
          – l3l_aze
          Aug 26 at 8:58




          Worked with Ubuntu 18.04 running through UserLAnd on Android 6.0.1. Thank you! :)
          – l3l_aze
          Aug 26 at 8:58












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1036278%2fnpm-is-incorrect-version-on-latest-ubuntu-18-04-installation%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          Unable to execute new pre-installation script (/var/lib/dpkg/tmp.ci/preinst)

          Running the scala interactive shell from the command line

          Do not install recommended packages of dependencies