Error: sudo required (or change ownership, or define N_PREFIX)

Install the specified version of nodejs

node has a module n, which is specially used to manage the version of node.js

    Global installation n module:

    npm install -g n
    
      upgrade node.js to the latest stable version

      n stable
      

      Solution:
      do you log in as root on the Ubuntu computer?If not, try running the command using sudo

      Column: sudo N stable to fill in the login password

      4. Install the specified version

      n v10.17.0
      

Read More: