Software installed under /opt folder not found when run as root or sudoIssue using Node.js / Express, Says...

What is this tube in a jet engine's air intake?

Are these two graphs isomorphic? Why/Why not?

How can a demon take control of a human body during REM sleep?

Can't make sense of a paragraph from Lovecraft

Locked Away- What am I?

How do spaceships determine each other's mass in space?

The (Easy) Road to Code

Gomel chasadim tovim - are there bad chasadim?

Count each bit-position separately over many 64-bit bitmasks, with AVX but not AVX2

Did Amazon pay $0 in taxes last year?

Short scifi story where reproductive organs are converted to produce "materials", pregnant protagonist is "found fit" to be a mother

Called into a meeting and told we are being made redundant (laid off) and "not to share outside". Can I tell my partner?

I can't die. Who am I?

Why do we say 'Pairwise Disjoint', rather than 'Disjoint'?

What do you call someone who likes to pick fights?

Can I negotiate a patent idea for a raise, under French law?

Rationale to prefer local variables over instance variables?

Has a sovereign Communist government ever run, and conceded loss, on a fair election?

Difference between `nmap local-IP-address` and `nmap localhost`

Under what conditions can the right to remain silent be revoked in the USA?

"If + would" conditional in present perfect tense

Is divide-by-zero a security vulnerability?

Having the player face themselves after the mid-game

Was it really inappropriate to write a pull request for the company I interviewed with?



Software installed under /opt folder not found when run as root or sudo


Issue using Node.js / Express, Says it's not installedNeed help fixing Segmentation FaultLink created to `nodejs` with `node` not workingnpm --version is different if use sudo npm --versionsetting $NODE in ubuntuHelp me with the firebase toolsInstalling node-sass on ubuntu 18.04 returns errorSudo Not Working for Node and NPM InstallHow to add /usr/bin to path after I mistakenly removed it (sudo and nano are no longer in path)How to set the path to the latest Open MPI version?













0















I've installed some of the software under /opt folder by compiling. I've added their "bin" directory to the path inside "/etc/environment". I can also use them as a regular user. For eg: NodeJS 10.15.1 has been installed in /opt and giving
node -v outputs v10.15.1.



Similarly if I run the same with sudo,



sudo node -v


I'm getting sudo: node: command not found.
If I become root by sudo -s and then execue node -v, I'm getting



Command 'node' not found, but can be installed with:

apt install nodejs


The reason I want to use "sudo" is, I've installed "Angular" using "npm". And at certain times, ng serve not reflecting new code changes automatically (which is default behavior of "ng serve" command).



So as pointed out in this post, I want to run this command with "sudo".



Why can't sudo find the executable when it has been added to "PATH"?









share



























    0















    I've installed some of the software under /opt folder by compiling. I've added their "bin" directory to the path inside "/etc/environment". I can also use them as a regular user. For eg: NodeJS 10.15.1 has been installed in /opt and giving
    node -v outputs v10.15.1.



    Similarly if I run the same with sudo,



    sudo node -v


    I'm getting sudo: node: command not found.
    If I become root by sudo -s and then execue node -v, I'm getting



    Command 'node' not found, but can be installed with:

    apt install nodejs


    The reason I want to use "sudo" is, I've installed "Angular" using "npm". And at certain times, ng serve not reflecting new code changes automatically (which is default behavior of "ng serve" command).



    So as pointed out in this post, I want to run this command with "sudo".



    Why can't sudo find the executable when it has been added to "PATH"?









    share

























      0












      0








      0








      I've installed some of the software under /opt folder by compiling. I've added their "bin" directory to the path inside "/etc/environment". I can also use them as a regular user. For eg: NodeJS 10.15.1 has been installed in /opt and giving
      node -v outputs v10.15.1.



      Similarly if I run the same with sudo,



      sudo node -v


      I'm getting sudo: node: command not found.
      If I become root by sudo -s and then execue node -v, I'm getting



      Command 'node' not found, but can be installed with:

      apt install nodejs


      The reason I want to use "sudo" is, I've installed "Angular" using "npm". And at certain times, ng serve not reflecting new code changes automatically (which is default behavior of "ng serve" command).



      So as pointed out in this post, I want to run this command with "sudo".



      Why can't sudo find the executable when it has been added to "PATH"?









      share














      I've installed some of the software under /opt folder by compiling. I've added their "bin" directory to the path inside "/etc/environment". I can also use them as a regular user. For eg: NodeJS 10.15.1 has been installed in /opt and giving
      node -v outputs v10.15.1.



      Similarly if I run the same with sudo,



      sudo node -v


      I'm getting sudo: node: command not found.
      If I become root by sudo -s and then execue node -v, I'm getting



      Command 'node' not found, but can be installed with:

      apt install nodejs


      The reason I want to use "sudo" is, I've installed "Angular" using "npm". And at certain times, ng serve not reflecting new code changes automatically (which is default behavior of "ng serve" command).



      So as pointed out in this post, I want to run this command with "sudo".



      Why can't sudo find the executable when it has been added to "PATH"?







      sudo environment-variables nodejs





      share












      share










      share



      share










      asked 9 mins ago









      learnerlearner

      3621516




      3621516






















          0






          active

          oldest

          votes











          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%2f1124477%2fsoftware-installed-under-opt-folder-not-found-when-run-as-root-or-sudo%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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%2f1124477%2fsoftware-installed-under-opt-folder-not-found-when-run-as-root-or-sudo%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

          Why do type traits not work with types in namespace scope?What are POD types in C++?Why can templates only be...

          Will tsunami waves travel forever if there was no land?Why do tsunami waves begin with the water flowing away...

          Should I use Docker or LXD?How to cache (more) data on SSD/RAM to avoid spin up?Unable to get Windows File...