Npm install keeps insisting on sudo

tygeradmin@tablet:~$ npm install -g appium

returns

> (node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory `/home/tygeradmin/.node/lib/node_modules/appium/node_modules/ws/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node: Finished
  COPY Release/bufferutil.node
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/obj.target/validation.node
  SOLINK_MODULE(target) Release/obj.target/validation.node: Finished
  COPY Release/validation.node
make: Leaving directory `/home/tygeradmin/.node/lib/node_modules/appium/node_modules/ws/build'
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.10.36","npm":"1.4.28"})
 
> [email protected] install /home/tygeradmin/.node/lib/node_modules/appium/node_modules/socket.io/node_modules/engine.io/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory `/home/tygeradmin/.node/lib/node_modules/appium/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node: Finished
  COPY Release/bufferutil.node
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/obj.target/validation.node
  SOLINK_MODULE(target) Release/obj.target/validation.node: Finished
  COPY Release/validation.node
make: Leaving directory `/home/tygeradmin/.node/lib/node_modules/appium/node_modules/socket.io/node_modules/engine.io/node_modules/ws/build'
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.10.36","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.10.36","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.10.36","npm":"1.4.28"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"0.10.36","npm":"1.4.28"})
 
> [email protected] install /home/tygeradmin/.node/lib/node_modules/appium/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

make: Entering directory `/home/tygeradmin/.node/lib/node_modules/appium/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node: Finished
  COPY Release/bufferutil.node
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/obj.target/validation.node
  SOLINK_MODULE(target) Release/obj.target/validation.node: Finished
  COPY Release/validation.node
make: Leaving directory `/home/tygeradmin/.node/lib/node_modules/appium/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/ws/build'
npm ERR! Error: EACCES, open '/home/tygeradmin/.npm/xmlbuilder/2.5.2/package.tgz'
npm ERR!  { [Error: EACCES, open '/home/tygeradmin/.npm/xmlbuilder/2.5.2/package.tgz']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/home/tygeradmin/.npm/xmlbuilder/2.5.2/package.tgz',
npm ERR!   parent: 'xml2js' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.8.0-29-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "appium"
npm ERR! cwd /home/tygeradmin
npm ERR! node -v v0.10.36
npm ERR! npm -v 1.4.28
npm ERR! path /home/tygeradmin/.npm/xmlbuilder/2.5.2/package.tgz
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/home/tygeradmin/.npm/xmlbuilder/2.5.2/package.tgz'
npm ERR! not ok code 0

Just install with sudo.

If you had to install Appium using `sudo npm install -g appium`, the solution is to reinstall Node using a method (Homebrew, for example) that does not require sudo to install global npm packages.

OK, reinstalling node.

Used to be. It’s been fixed in 1.2.3.

1 Like

I remade and installed Node.

appium-doctor says things are fine:

Running Android Checks
✔ ANDROID_HOME is set to "/home/tygeradmin/android-sdk-linux"
✔ JAVA_HOME is set to "/usr/lib/jvm/java-7-oracle."
✔ ADB exists at /home/tygeradmin/android-sdk-linux/platform-tools/adb
✔ Android exists at /home/tygeradmin/android-sdk-linux/tools/android
✔ Emulator exists at /home/tygeradmin/android-sdk-linux/tools/emulator
✔ Android Checks were successful.

✔ All Checks were successful

Still getting the “reinstall Node” error, however.