Navigation

    ML
    • Register
    • Login
    • Search
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

    Node for non root users

    IT Discussion
    node npm
    2
    6
    1350
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Ambarishrh
      Ambarishrh last edited by

      I am trying to setup node for non root users but couldn't figure it out. Below are the commands I used till now

      wget https://nodejs.org/dist/v5.6.0/node-v5.6.0.tar.gz
      tar -xvzf node-v5.6.0.tar.gz
      cd node-v5.6.0
      ./configure
      make
      make install

      And from few sites, found that to enable access to non root users, execute below commands:
      ln -s /usr/local/bin/node /usr/bin/node
      ln -s /usr/local/lib/node /usr/lib/node
      ln -s /usr/local/bin/npm /usr/bin/npm

      Still when i switch back to a regular user, and try to run an npm command, gives me error:

      Eg: npm i gulp -g

      Gives me
      npm WARN deprecated [email protected]: [email protected]<3.0.0 is no longer maintained. Upgrade to [email protected]^4.0.0.
      npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/gulp
      npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
      /usr/local/lib
      └── [email protected]

      npm ERR! Linux 3.10.0-327.4.4.el7.x86_64
      npm ERR! argv "/usr/local/bin/node" "/bin/npm" "i" "gulp" "-g"
      npm ERR! node v5.6.0
      npm ERR! npm v3.6.0
      npm ERR! path /usr/local/lib/node_modules/gulp
      npm ERR! code EACCES
      npm ERR! errno -13
      npm ERR! syscall access

      npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/gulp'
      npm ERR! at Error (native)
      npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/gulp']
      npm ERR! errno: -13,
      npm ERR! code: 'EACCES',
      npm ERR! syscall: 'access',
      npm ERR! path: '/usr/local/lib/node_modules/gulp' }
      npm ERR!
      npm ERR! Please try running this command again as root/Administrator.

      npm ERR! Please include the following file with any support request:
      npm ERR! /var/home/user/npm-debug.log

      1 Reply Last reply Reply Quote 0
      • scottalanmiller
        scottalanmiller last edited by

        Why are you installing Node from source and not via NVM?

        1 Reply Last reply Reply Quote 1
        • Ambarishrh
          Ambarishrh last edited by

          I just tried with NVM, and installed gulp on root, but cant use the same on a non root user.

          scottalanmiller 1 Reply Last reply Reply Quote 0
          • Ambarishrh
            Ambarishrh last edited by

            Some sites mention to change the ownership of /usr/local to that user, which for me doesnt makes sense. What if you need to install gulp for example to another user? Dont seem to be right to keep changing permission as and when required by new user account!

            1 Reply Last reply Reply Quote 0
            • scottalanmiller
              scottalanmiller @Ambarishrh last edited by

              @Ambarishrh said:

              I just tried with NVM, and installed gulp on root, but cant use the same on a non root user.

              install NVM as root, run it as the user to set up the right version for them.

              1 Reply Last reply Reply Quote 1
              • Ambarishrh
                Ambarishrh last edited by

                Installed nvm as root and when i try to run anything related to that as a regular user;

                Eg: nvm ls-remote
                bash: nvm: command not found

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post