How can I install npm on 17.10?












10















I just wanted to install npm via terminal and now I am just stuck with some dependencies.



It wants me to install a few dependencies, for example:



libssl1.0-dev
nodejs-dev
node-gyp


Even if I try to install these first, it tells me I need the predecessor before.



Last instance of dependency is libssl-dev and this seems already installed.



Target is to install npm for making this electron fork run on my system.



Thanks for you help.










share|improve this question

























  • @karel means i have no chance to install it on 17.10 and i am forced to downgrade to 16.04 again?

    – Deniz
    Jan 10 '18 at 8:56











  • bro, i just wanted to know how to install npm on my system. I cant just simple use "sudo apt install npm" because of the problem i have wrote in my first comment.

    – Deniz
    Jan 10 '18 at 9:19


















10















I just wanted to install npm via terminal and now I am just stuck with some dependencies.



It wants me to install a few dependencies, for example:



libssl1.0-dev
nodejs-dev
node-gyp


Even if I try to install these first, it tells me I need the predecessor before.



Last instance of dependency is libssl-dev and this seems already installed.



Target is to install npm for making this electron fork run on my system.



Thanks for you help.










share|improve this question

























  • @karel means i have no chance to install it on 17.10 and i am forced to downgrade to 16.04 again?

    – Deniz
    Jan 10 '18 at 8:56











  • bro, i just wanted to know how to install npm on my system. I cant just simple use "sudo apt install npm" because of the problem i have wrote in my first comment.

    – Deniz
    Jan 10 '18 at 9:19
















10












10








10








I just wanted to install npm via terminal and now I am just stuck with some dependencies.



It wants me to install a few dependencies, for example:



libssl1.0-dev
nodejs-dev
node-gyp


Even if I try to install these first, it tells me I need the predecessor before.



Last instance of dependency is libssl-dev and this seems already installed.



Target is to install npm for making this electron fork run on my system.



Thanks for you help.










share|improve this question
















I just wanted to install npm via terminal and now I am just stuck with some dependencies.



It wants me to install a few dependencies, for example:



libssl1.0-dev
nodejs-dev
node-gyp


Even if I try to install these first, it tells me I need the predecessor before.



Last instance of dependency is libssl-dev and this seems already installed.



Target is to install npm for making this electron fork run on my system.



Thanks for you help.







apt 17.10 npm electron






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 9 '18 at 21:07









Zanna

50.6k13135241




50.6k13135241










asked Jan 9 '18 at 17:25









DenizDeniz

77115




77115













  • @karel means i have no chance to install it on 17.10 and i am forced to downgrade to 16.04 again?

    – Deniz
    Jan 10 '18 at 8:56











  • bro, i just wanted to know how to install npm on my system. I cant just simple use "sudo apt install npm" because of the problem i have wrote in my first comment.

    – Deniz
    Jan 10 '18 at 9:19





















  • @karel means i have no chance to install it on 17.10 and i am forced to downgrade to 16.04 again?

    – Deniz
    Jan 10 '18 at 8:56











  • bro, i just wanted to know how to install npm on my system. I cant just simple use "sudo apt install npm" because of the problem i have wrote in my first comment.

    – Deniz
    Jan 10 '18 at 9:19



















@karel means i have no chance to install it on 17.10 and i am forced to downgrade to 16.04 again?

– Deniz
Jan 10 '18 at 8:56





@karel means i have no chance to install it on 17.10 and i am forced to downgrade to 16.04 again?

– Deniz
Jan 10 '18 at 8:56













bro, i just wanted to know how to install npm on my system. I cant just simple use "sudo apt install npm" because of the problem i have wrote in my first comment.

– Deniz
Jan 10 '18 at 9:19







bro, i just wanted to know how to install npm on my system. I cant just simple use "sudo apt install npm" because of the problem i have wrote in my first comment.

– Deniz
Jan 10 '18 at 9:19












5 Answers
5






active

oldest

votes


















8














Note: This answer has been updated since when it was first posted because there is now a better way of installing the latest version of npm which is built-in with the node snap package for installing Node.js. After running the below commands running npm -v will show that the latest version of npm is installed and being used.





Node.js is available as a snap package in all currently supported versions of Ubuntu. Specific to Node.js, developers can choose from one of the currently supported releases and get regular automatic updates directly from NodeSource. Node.js versions 6, 8, 9, 10, 11 and 12 are currently available, with the Snap Store being updated within hours, or minutes of a Node.js release.



Node can be installed with a single command, for example:



sudo snap install node --classic --channel 11/stable # also install snapd in 14.04 


The node snap can be accessed by the command node, for example:



$ node -v  
v11.5.0


An up-to-date version of npm will installed as part of the node snap. npm should be run outside of the node repl, in your normal shell. After installing the node snap run the following command to enable npm update checking:



sudo chown -R $USER:$(id -gn $USER) /home/your-username/.config


Replace your-username in the above command with your own username. Then run npm -v to check if the version of npm is up-to-date. As an example I checked that npm was up-to-date, checked the version of an already installed package named yarn with the command npm list yarn and then updated the existing yarn package to the latest version with the command npm update yarn



Users can switch between versions of Node.js at any time without needing to involve additional tools like nvm (Node Version Manager), for example:



sudo snap refresh node --channel=10/stable


Users can test bleeding-edge versions of Node.js that can be installed from the latest edge channel which is currently tracking Node.js version 12 by switching with:



sudo snap switch node --edge


This approach is only recommended for those users who are willing to participate in testing and bug reporting upstream.



Node.js LTS Schedule



Release LTS Status  Codename    LTS Start       Maintenance Start Maintenance End
6.x Active Boron 2016-10-18 April 2018 April 2019
7.x No LTS
8.x Active Carbon 2017-10-31 April 2019 December 2019
9.x No LTS
10.x Active Dubnium October 2018 April 2020 April 2021
11.x No LTS 2019-04-01 2019-06-30
12.x No LTS 2019-10-22 2021-04-01 2022-04-01





share|improve this answer


























  • Didn't work for me

    – Jonathan
    Jan 19 '18 at 0:40











  • Snap packages are terrible for SSDs. They are frequently updated causing heavy read/write actions on the disk, which is not optimal for the life of the SSD. I avoid them as much as possible. There's also the issue of security with Snaps, so just be careful.

    – Seth Bergman
    Aug 23 '18 at 7:53



















2














I had the same issue. libssl is troublesome since lots of packages want different versions of it. The top troublemakers for me are Spotify, Viber, DotNet Core, php5.6 (legacy system).



Anyway, this solution seems to have worked:



Based on the answer by Jonathan Leaders, if you look at the script that it's downloading, you'll see it mention 2 key points: the repository, and the key.



For some reason after running just those commands, nodejs was still referring to the one in the official Ubuntu repositories, and it was an old version, with conflicting requirements for libssl.



Add them manually for reliable results (as root):



echo 'deb https://deb.nodesource.com/node_9.x artful main' > /etc/apt/sources.list.d/nodesource.list
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -


After that, simply apt-get update and then apt-get install nodejs



After that you'll have npm as well without installing anything additionally.



Note that this installs Nodejs 9.0, but I'm sure that the same method works for other versions as well. You just have to switch the version number in the repository source in /etc/apt/sources.list.d/nodesource.list






share|improve this answer































    1














    First see what version number is latest here:
    https://github.com/nodesource/distributions/tree/master/deb



    In our case it is setup_9.x



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


    Prove it is now installed



    npm -v



    Source: https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/



    Edit: Added 'curl' to initial dependencies.






    share|improve this answer

































      1














      n-install



      Node and npm installed with one line of bash.



      Installation of n, the Node.js version manager, on Unix-like platforms, without needing to install Node.js first.
      Additionally, installs scripts n-update for later on-demand updating of n, and n-uninstall for uninstalling.



      The simplest case is installation of n with confirmation prompt, with subsequent installation of the latest LTS Node.js version:



      curl -L https://git.io/n-install | bash


      This is by far the simplest way to get started with both n and Node.js - even if you're looking to install only the latest LTS (long-term support) Node.js version, with no (immediate) plans to install multiple versions. The best part is that you can update the node version on the fly. It's got to be my favorite node tool. NVM is similar, but n is my preference.






      share|improve this answer































        0














        Also, you can use NVM. Which is a Node Version Manager that allows switching beetween diferent Node versions in a very simple way.
        Just run the following commands:



        curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash



        command -v nvm



        Then, reopen your terminal and execute:



        nvm install lts/*



        That will download Nodejs source code and make installation for you.



        Also, one of the key benefits of NVM, is the ability to install global packages without using sudo



        If you want more information about NVM, check their Github Repo:



        https://github.com/creationix/nvm






        share|improve this answer
























        • If the Node.js snap package is installed it is possible to switch between different versions of Node.js without needing to involve additional tools like nvm.

          – karel
          Apr 5 '18 at 1:15











        • This is a great question. I don't believe you can since the core principal of snaps is to have the latest version of the software, which is isolated from the rest of the filesystem.

          – Seth Bergman
          Aug 23 '18 at 7:57











        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',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        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%2f993975%2fhow-can-i-install-npm-on-17-10%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        8














        Note: This answer has been updated since when it was first posted because there is now a better way of installing the latest version of npm which is built-in with the node snap package for installing Node.js. After running the below commands running npm -v will show that the latest version of npm is installed and being used.





        Node.js is available as a snap package in all currently supported versions of Ubuntu. Specific to Node.js, developers can choose from one of the currently supported releases and get regular automatic updates directly from NodeSource. Node.js versions 6, 8, 9, 10, 11 and 12 are currently available, with the Snap Store being updated within hours, or minutes of a Node.js release.



        Node can be installed with a single command, for example:



        sudo snap install node --classic --channel 11/stable # also install snapd in 14.04 


        The node snap can be accessed by the command node, for example:



        $ node -v  
        v11.5.0


        An up-to-date version of npm will installed as part of the node snap. npm should be run outside of the node repl, in your normal shell. After installing the node snap run the following command to enable npm update checking:



        sudo chown -R $USER:$(id -gn $USER) /home/your-username/.config


        Replace your-username in the above command with your own username. Then run npm -v to check if the version of npm is up-to-date. As an example I checked that npm was up-to-date, checked the version of an already installed package named yarn with the command npm list yarn and then updated the existing yarn package to the latest version with the command npm update yarn



        Users can switch between versions of Node.js at any time without needing to involve additional tools like nvm (Node Version Manager), for example:



        sudo snap refresh node --channel=10/stable


        Users can test bleeding-edge versions of Node.js that can be installed from the latest edge channel which is currently tracking Node.js version 12 by switching with:



        sudo snap switch node --edge


        This approach is only recommended for those users who are willing to participate in testing and bug reporting upstream.



        Node.js LTS Schedule



        Release LTS Status  Codename    LTS Start       Maintenance Start Maintenance End
        6.x Active Boron 2016-10-18 April 2018 April 2019
        7.x No LTS
        8.x Active Carbon 2017-10-31 April 2019 December 2019
        9.x No LTS
        10.x Active Dubnium October 2018 April 2020 April 2021
        11.x No LTS 2019-04-01 2019-06-30
        12.x No LTS 2019-10-22 2021-04-01 2022-04-01





        share|improve this answer


























        • Didn't work for me

          – Jonathan
          Jan 19 '18 at 0:40











        • Snap packages are terrible for SSDs. They are frequently updated causing heavy read/write actions on the disk, which is not optimal for the life of the SSD. I avoid them as much as possible. There's also the issue of security with Snaps, so just be careful.

          – Seth Bergman
          Aug 23 '18 at 7:53
















        8














        Note: This answer has been updated since when it was first posted because there is now a better way of installing the latest version of npm which is built-in with the node snap package for installing Node.js. After running the below commands running npm -v will show that the latest version of npm is installed and being used.





        Node.js is available as a snap package in all currently supported versions of Ubuntu. Specific to Node.js, developers can choose from one of the currently supported releases and get regular automatic updates directly from NodeSource. Node.js versions 6, 8, 9, 10, 11 and 12 are currently available, with the Snap Store being updated within hours, or minutes of a Node.js release.



        Node can be installed with a single command, for example:



        sudo snap install node --classic --channel 11/stable # also install snapd in 14.04 


        The node snap can be accessed by the command node, for example:



        $ node -v  
        v11.5.0


        An up-to-date version of npm will installed as part of the node snap. npm should be run outside of the node repl, in your normal shell. After installing the node snap run the following command to enable npm update checking:



        sudo chown -R $USER:$(id -gn $USER) /home/your-username/.config


        Replace your-username in the above command with your own username. Then run npm -v to check if the version of npm is up-to-date. As an example I checked that npm was up-to-date, checked the version of an already installed package named yarn with the command npm list yarn and then updated the existing yarn package to the latest version with the command npm update yarn



        Users can switch between versions of Node.js at any time without needing to involve additional tools like nvm (Node Version Manager), for example:



        sudo snap refresh node --channel=10/stable


        Users can test bleeding-edge versions of Node.js that can be installed from the latest edge channel which is currently tracking Node.js version 12 by switching with:



        sudo snap switch node --edge


        This approach is only recommended for those users who are willing to participate in testing and bug reporting upstream.



        Node.js LTS Schedule



        Release LTS Status  Codename    LTS Start       Maintenance Start Maintenance End
        6.x Active Boron 2016-10-18 April 2018 April 2019
        7.x No LTS
        8.x Active Carbon 2017-10-31 April 2019 December 2019
        9.x No LTS
        10.x Active Dubnium October 2018 April 2020 April 2021
        11.x No LTS 2019-04-01 2019-06-30
        12.x No LTS 2019-10-22 2021-04-01 2022-04-01





        share|improve this answer


























        • Didn't work for me

          – Jonathan
          Jan 19 '18 at 0:40











        • Snap packages are terrible for SSDs. They are frequently updated causing heavy read/write actions on the disk, which is not optimal for the life of the SSD. I avoid them as much as possible. There's also the issue of security with Snaps, so just be careful.

          – Seth Bergman
          Aug 23 '18 at 7:53














        8












        8








        8







        Note: This answer has been updated since when it was first posted because there is now a better way of installing the latest version of npm which is built-in with the node snap package for installing Node.js. After running the below commands running npm -v will show that the latest version of npm is installed and being used.





        Node.js is available as a snap package in all currently supported versions of Ubuntu. Specific to Node.js, developers can choose from one of the currently supported releases and get regular automatic updates directly from NodeSource. Node.js versions 6, 8, 9, 10, 11 and 12 are currently available, with the Snap Store being updated within hours, or minutes of a Node.js release.



        Node can be installed with a single command, for example:



        sudo snap install node --classic --channel 11/stable # also install snapd in 14.04 


        The node snap can be accessed by the command node, for example:



        $ node -v  
        v11.5.0


        An up-to-date version of npm will installed as part of the node snap. npm should be run outside of the node repl, in your normal shell. After installing the node snap run the following command to enable npm update checking:



        sudo chown -R $USER:$(id -gn $USER) /home/your-username/.config


        Replace your-username in the above command with your own username. Then run npm -v to check if the version of npm is up-to-date. As an example I checked that npm was up-to-date, checked the version of an already installed package named yarn with the command npm list yarn and then updated the existing yarn package to the latest version with the command npm update yarn



        Users can switch between versions of Node.js at any time without needing to involve additional tools like nvm (Node Version Manager), for example:



        sudo snap refresh node --channel=10/stable


        Users can test bleeding-edge versions of Node.js that can be installed from the latest edge channel which is currently tracking Node.js version 12 by switching with:



        sudo snap switch node --edge


        This approach is only recommended for those users who are willing to participate in testing and bug reporting upstream.



        Node.js LTS Schedule



        Release LTS Status  Codename    LTS Start       Maintenance Start Maintenance End
        6.x Active Boron 2016-10-18 April 2018 April 2019
        7.x No LTS
        8.x Active Carbon 2017-10-31 April 2019 December 2019
        9.x No LTS
        10.x Active Dubnium October 2018 April 2020 April 2021
        11.x No LTS 2019-04-01 2019-06-30
        12.x No LTS 2019-10-22 2021-04-01 2022-04-01





        share|improve this answer















        Note: This answer has been updated since when it was first posted because there is now a better way of installing the latest version of npm which is built-in with the node snap package for installing Node.js. After running the below commands running npm -v will show that the latest version of npm is installed and being used.





        Node.js is available as a snap package in all currently supported versions of Ubuntu. Specific to Node.js, developers can choose from one of the currently supported releases and get regular automatic updates directly from NodeSource. Node.js versions 6, 8, 9, 10, 11 and 12 are currently available, with the Snap Store being updated within hours, or minutes of a Node.js release.



        Node can be installed with a single command, for example:



        sudo snap install node --classic --channel 11/stable # also install snapd in 14.04 


        The node snap can be accessed by the command node, for example:



        $ node -v  
        v11.5.0


        An up-to-date version of npm will installed as part of the node snap. npm should be run outside of the node repl, in your normal shell. After installing the node snap run the following command to enable npm update checking:



        sudo chown -R $USER:$(id -gn $USER) /home/your-username/.config


        Replace your-username in the above command with your own username. Then run npm -v to check if the version of npm is up-to-date. As an example I checked that npm was up-to-date, checked the version of an already installed package named yarn with the command npm list yarn and then updated the existing yarn package to the latest version with the command npm update yarn



        Users can switch between versions of Node.js at any time without needing to involve additional tools like nvm (Node Version Manager), for example:



        sudo snap refresh node --channel=10/stable


        Users can test bleeding-edge versions of Node.js that can be installed from the latest edge channel which is currently tracking Node.js version 12 by switching with:



        sudo snap switch node --edge


        This approach is only recommended for those users who are willing to participate in testing and bug reporting upstream.



        Node.js LTS Schedule



        Release LTS Status  Codename    LTS Start       Maintenance Start Maintenance End
        6.x Active Boron 2016-10-18 April 2018 April 2019
        7.x No LTS
        8.x Active Carbon 2017-10-31 April 2019 December 2019
        9.x No LTS
        10.x Active Dubnium October 2018 April 2020 April 2021
        11.x No LTS 2019-04-01 2019-06-30
        12.x No LTS 2019-10-22 2021-04-01 2022-04-01






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 31 '18 at 11:13

























        answered Jan 10 '18 at 9:08









        karelkarel

        58.6k13128147




        58.6k13128147













        • Didn't work for me

          – Jonathan
          Jan 19 '18 at 0:40











        • Snap packages are terrible for SSDs. They are frequently updated causing heavy read/write actions on the disk, which is not optimal for the life of the SSD. I avoid them as much as possible. There's also the issue of security with Snaps, so just be careful.

          – Seth Bergman
          Aug 23 '18 at 7:53



















        • Didn't work for me

          – Jonathan
          Jan 19 '18 at 0:40











        • Snap packages are terrible for SSDs. They are frequently updated causing heavy read/write actions on the disk, which is not optimal for the life of the SSD. I avoid them as much as possible. There's also the issue of security with Snaps, so just be careful.

          – Seth Bergman
          Aug 23 '18 at 7:53

















        Didn't work for me

        – Jonathan
        Jan 19 '18 at 0:40





        Didn't work for me

        – Jonathan
        Jan 19 '18 at 0:40













        Snap packages are terrible for SSDs. They are frequently updated causing heavy read/write actions on the disk, which is not optimal for the life of the SSD. I avoid them as much as possible. There's also the issue of security with Snaps, so just be careful.

        – Seth Bergman
        Aug 23 '18 at 7:53





        Snap packages are terrible for SSDs. They are frequently updated causing heavy read/write actions on the disk, which is not optimal for the life of the SSD. I avoid them as much as possible. There's also the issue of security with Snaps, so just be careful.

        – Seth Bergman
        Aug 23 '18 at 7:53













        2














        I had the same issue. libssl is troublesome since lots of packages want different versions of it. The top troublemakers for me are Spotify, Viber, DotNet Core, php5.6 (legacy system).



        Anyway, this solution seems to have worked:



        Based on the answer by Jonathan Leaders, if you look at the script that it's downloading, you'll see it mention 2 key points: the repository, and the key.



        For some reason after running just those commands, nodejs was still referring to the one in the official Ubuntu repositories, and it was an old version, with conflicting requirements for libssl.



        Add them manually for reliable results (as root):



        echo 'deb https://deb.nodesource.com/node_9.x artful main' > /etc/apt/sources.list.d/nodesource.list
        curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -


        After that, simply apt-get update and then apt-get install nodejs



        After that you'll have npm as well without installing anything additionally.



        Note that this installs Nodejs 9.0, but I'm sure that the same method works for other versions as well. You just have to switch the version number in the repository source in /etc/apt/sources.list.d/nodesource.list






        share|improve this answer




























          2














          I had the same issue. libssl is troublesome since lots of packages want different versions of it. The top troublemakers for me are Spotify, Viber, DotNet Core, php5.6 (legacy system).



          Anyway, this solution seems to have worked:



          Based on the answer by Jonathan Leaders, if you look at the script that it's downloading, you'll see it mention 2 key points: the repository, and the key.



          For some reason after running just those commands, nodejs was still referring to the one in the official Ubuntu repositories, and it was an old version, with conflicting requirements for libssl.



          Add them manually for reliable results (as root):



          echo 'deb https://deb.nodesource.com/node_9.x artful main' > /etc/apt/sources.list.d/nodesource.list
          curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -


          After that, simply apt-get update and then apt-get install nodejs



          After that you'll have npm as well without installing anything additionally.



          Note that this installs Nodejs 9.0, but I'm sure that the same method works for other versions as well. You just have to switch the version number in the repository source in /etc/apt/sources.list.d/nodesource.list






          share|improve this answer


























            2












            2








            2







            I had the same issue. libssl is troublesome since lots of packages want different versions of it. The top troublemakers for me are Spotify, Viber, DotNet Core, php5.6 (legacy system).



            Anyway, this solution seems to have worked:



            Based on the answer by Jonathan Leaders, if you look at the script that it's downloading, you'll see it mention 2 key points: the repository, and the key.



            For some reason after running just those commands, nodejs was still referring to the one in the official Ubuntu repositories, and it was an old version, with conflicting requirements for libssl.



            Add them manually for reliable results (as root):



            echo 'deb https://deb.nodesource.com/node_9.x artful main' > /etc/apt/sources.list.d/nodesource.list
            curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -


            After that, simply apt-get update and then apt-get install nodejs



            After that you'll have npm as well without installing anything additionally.



            Note that this installs Nodejs 9.0, but I'm sure that the same method works for other versions as well. You just have to switch the version number in the repository source in /etc/apt/sources.list.d/nodesource.list






            share|improve this answer













            I had the same issue. libssl is troublesome since lots of packages want different versions of it. The top troublemakers for me are Spotify, Viber, DotNet Core, php5.6 (legacy system).



            Anyway, this solution seems to have worked:



            Based on the answer by Jonathan Leaders, if you look at the script that it's downloading, you'll see it mention 2 key points: the repository, and the key.



            For some reason after running just those commands, nodejs was still referring to the one in the official Ubuntu repositories, and it was an old version, with conflicting requirements for libssl.



            Add them manually for reliable results (as root):



            echo 'deb https://deb.nodesource.com/node_9.x artful main' > /etc/apt/sources.list.d/nodesource.list
            curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add -


            After that, simply apt-get update and then apt-get install nodejs



            After that you'll have npm as well without installing anything additionally.



            Note that this installs Nodejs 9.0, but I'm sure that the same method works for other versions as well. You just have to switch the version number in the repository source in /etc/apt/sources.list.d/nodesource.list







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 16 '18 at 16:17









            AlexanderMPAlexanderMP

            1286




            1286























                1














                First see what version number is latest here:
                https://github.com/nodesource/distributions/tree/master/deb



                In our case it is setup_9.x



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


                Prove it is now installed



                npm -v



                Source: https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/



                Edit: Added 'curl' to initial dependencies.






                share|improve this answer






























                  1














                  First see what version number is latest here:
                  https://github.com/nodesource/distributions/tree/master/deb



                  In our case it is setup_9.x



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


                  Prove it is now installed



                  npm -v



                  Source: https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/



                  Edit: Added 'curl' to initial dependencies.






                  share|improve this answer




























                    1












                    1








                    1







                    First see what version number is latest here:
                    https://github.com/nodesource/distributions/tree/master/deb



                    In our case it is setup_9.x



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


                    Prove it is now installed



                    npm -v



                    Source: https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/



                    Edit: Added 'curl' to initial dependencies.






                    share|improve this answer















                    First see what version number is latest here:
                    https://github.com/nodesource/distributions/tree/master/deb



                    In our case it is setup_9.x



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


                    Prove it is now installed



                    npm -v



                    Source: https://tecadmin.net/install-latest-nodejs-npm-on-ubuntu/



                    Edit: Added 'curl' to initial dependencies.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Jun 15 '18 at 1:51









                    Community

                    1




                    1










                    answered Jan 19 '18 at 0:49









                    JonathanJonathan

                    1,34531530




                    1,34531530























                        1














                        n-install



                        Node and npm installed with one line of bash.



                        Installation of n, the Node.js version manager, on Unix-like platforms, without needing to install Node.js first.
                        Additionally, installs scripts n-update for later on-demand updating of n, and n-uninstall for uninstalling.



                        The simplest case is installation of n with confirmation prompt, with subsequent installation of the latest LTS Node.js version:



                        curl -L https://git.io/n-install | bash


                        This is by far the simplest way to get started with both n and Node.js - even if you're looking to install only the latest LTS (long-term support) Node.js version, with no (immediate) plans to install multiple versions. The best part is that you can update the node version on the fly. It's got to be my favorite node tool. NVM is similar, but n is my preference.






                        share|improve this answer




























                          1














                          n-install



                          Node and npm installed with one line of bash.



                          Installation of n, the Node.js version manager, on Unix-like platforms, without needing to install Node.js first.
                          Additionally, installs scripts n-update for later on-demand updating of n, and n-uninstall for uninstalling.



                          The simplest case is installation of n with confirmation prompt, with subsequent installation of the latest LTS Node.js version:



                          curl -L https://git.io/n-install | bash


                          This is by far the simplest way to get started with both n and Node.js - even if you're looking to install only the latest LTS (long-term support) Node.js version, with no (immediate) plans to install multiple versions. The best part is that you can update the node version on the fly. It's got to be my favorite node tool. NVM is similar, but n is my preference.






                          share|improve this answer


























                            1












                            1








                            1







                            n-install



                            Node and npm installed with one line of bash.



                            Installation of n, the Node.js version manager, on Unix-like platforms, without needing to install Node.js first.
                            Additionally, installs scripts n-update for later on-demand updating of n, and n-uninstall for uninstalling.



                            The simplest case is installation of n with confirmation prompt, with subsequent installation of the latest LTS Node.js version:



                            curl -L https://git.io/n-install | bash


                            This is by far the simplest way to get started with both n and Node.js - even if you're looking to install only the latest LTS (long-term support) Node.js version, with no (immediate) plans to install multiple versions. The best part is that you can update the node version on the fly. It's got to be my favorite node tool. NVM is similar, but n is my preference.






                            share|improve this answer













                            n-install



                            Node and npm installed with one line of bash.



                            Installation of n, the Node.js version manager, on Unix-like platforms, without needing to install Node.js first.
                            Additionally, installs scripts n-update for later on-demand updating of n, and n-uninstall for uninstalling.



                            The simplest case is installation of n with confirmation prompt, with subsequent installation of the latest LTS Node.js version:



                            curl -L https://git.io/n-install | bash


                            This is by far the simplest way to get started with both n and Node.js - even if you're looking to install only the latest LTS (long-term support) Node.js version, with no (immediate) plans to install multiple versions. The best part is that you can update the node version on the fly. It's got to be my favorite node tool. NVM is similar, but n is my preference.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Aug 23 '18 at 7:30









                            Seth BergmanSeth Bergman

                            887




                            887























                                0














                                Also, you can use NVM. Which is a Node Version Manager that allows switching beetween diferent Node versions in a very simple way.
                                Just run the following commands:



                                curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash



                                command -v nvm



                                Then, reopen your terminal and execute:



                                nvm install lts/*



                                That will download Nodejs source code and make installation for you.



                                Also, one of the key benefits of NVM, is the ability to install global packages without using sudo



                                If you want more information about NVM, check their Github Repo:



                                https://github.com/creationix/nvm






                                share|improve this answer
























                                • If the Node.js snap package is installed it is possible to switch between different versions of Node.js without needing to involve additional tools like nvm.

                                  – karel
                                  Apr 5 '18 at 1:15











                                • This is a great question. I don't believe you can since the core principal of snaps is to have the latest version of the software, which is isolated from the rest of the filesystem.

                                  – Seth Bergman
                                  Aug 23 '18 at 7:57
















                                0














                                Also, you can use NVM. Which is a Node Version Manager that allows switching beetween diferent Node versions in a very simple way.
                                Just run the following commands:



                                curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash



                                command -v nvm



                                Then, reopen your terminal and execute:



                                nvm install lts/*



                                That will download Nodejs source code and make installation for you.



                                Also, one of the key benefits of NVM, is the ability to install global packages without using sudo



                                If you want more information about NVM, check their Github Repo:



                                https://github.com/creationix/nvm






                                share|improve this answer
























                                • If the Node.js snap package is installed it is possible to switch between different versions of Node.js without needing to involve additional tools like nvm.

                                  – karel
                                  Apr 5 '18 at 1:15











                                • This is a great question. I don't believe you can since the core principal of snaps is to have the latest version of the software, which is isolated from the rest of the filesystem.

                                  – Seth Bergman
                                  Aug 23 '18 at 7:57














                                0












                                0








                                0







                                Also, you can use NVM. Which is a Node Version Manager that allows switching beetween diferent Node versions in a very simple way.
                                Just run the following commands:



                                curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash



                                command -v nvm



                                Then, reopen your terminal and execute:



                                nvm install lts/*



                                That will download Nodejs source code and make installation for you.



                                Also, one of the key benefits of NVM, is the ability to install global packages without using sudo



                                If you want more information about NVM, check their Github Repo:



                                https://github.com/creationix/nvm






                                share|improve this answer













                                Also, you can use NVM. Which is a Node Version Manager that allows switching beetween diferent Node versions in a very simple way.
                                Just run the following commands:



                                curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash



                                command -v nvm



                                Then, reopen your terminal and execute:



                                nvm install lts/*



                                That will download Nodejs source code and make installation for you.



                                Also, one of the key benefits of NVM, is the ability to install global packages without using sudo



                                If you want more information about NVM, check their Github Repo:



                                https://github.com/creationix/nvm







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Apr 4 '18 at 23:35









                                王カルロス王カルロス

                                416




                                416













                                • If the Node.js snap package is installed it is possible to switch between different versions of Node.js without needing to involve additional tools like nvm.

                                  – karel
                                  Apr 5 '18 at 1:15











                                • This is a great question. I don't believe you can since the core principal of snaps is to have the latest version of the software, which is isolated from the rest of the filesystem.

                                  – Seth Bergman
                                  Aug 23 '18 at 7:57



















                                • If the Node.js snap package is installed it is possible to switch between different versions of Node.js without needing to involve additional tools like nvm.

                                  – karel
                                  Apr 5 '18 at 1:15











                                • This is a great question. I don't believe you can since the core principal of snaps is to have the latest version of the software, which is isolated from the rest of the filesystem.

                                  – Seth Bergman
                                  Aug 23 '18 at 7:57

















                                If the Node.js snap package is installed it is possible to switch between different versions of Node.js without needing to involve additional tools like nvm.

                                – karel
                                Apr 5 '18 at 1:15





                                If the Node.js snap package is installed it is possible to switch between different versions of Node.js without needing to involve additional tools like nvm.

                                – karel
                                Apr 5 '18 at 1:15













                                This is a great question. I don't believe you can since the core principal of snaps is to have the latest version of the software, which is isolated from the rest of the filesystem.

                                – Seth Bergman
                                Aug 23 '18 at 7:57





                                This is a great question. I don't believe you can since the core principal of snaps is to have the latest version of the software, which is isolated from the rest of the filesystem.

                                – Seth Bergman
                                Aug 23 '18 at 7:57


















                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Ask Ubuntu!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f993975%2fhow-can-i-install-npm-on-17-10%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                How to change which sound is reproduced for terminal bell?

                                Can I use Tabulator js library in my java Spring + Thymeleaf project?

                                Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents