试图在Ubuntu上使用Appium,但获取node.js:134错误

试图在Ubuntu上使用Appium,但获取node.js:134错误,node.js,npm,ubuntu-14.04,sudo,appium,Node.js,Npm,Ubuntu 14.04,Sudo,Appium,我已经用安装了node sudo apt-get install -y nodejs 和苹果 sudo npm install -g appium 在这两种情况下,我都被迫像在Ubuntu上一样使用sudo。上的appium页面说不要使用sudo,但我相信在Ubuntu中,按照上的节点页面的指示使用sudo是可以的(而且是必要的) 当我尝试用appium&启动appium时,甚至只是 appium 我明白了 但是,当我卸载节点,然后尝试在没有sudo的情况下重新安装它时,如图所示,我得

我已经用安装了node

sudo apt-get install -y nodejs
和苹果

sudo npm install -g appium  
在这两种情况下,我都被迫像在Ubuntu上一样使用
sudo
。上的appium页面说不要使用
sudo
,但我相信在Ubuntu中,按照上的节点页面的指示使用
sudo
是可以的(而且是必要的)

当我尝试用
appium&
启动appium时,甚至只是

appium
我明白了

但是,当我卸载节点,然后尝试在没有sudo的情况下重新安装它时,如图所示,我得到:

$ apt-get install nodejs
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
我尝试使用从源本地构建节点

$ mkdir ~/local
$ ./configure --prefix=~/local
creating  ./icu_config.gypi
  { 'target_defaults': { 'cflags': [],
                   'default_configuration': 'Release',
                   'defines': [],
                   'include_dirs': [],
                   'libraries': []},
'variables': { 'clang': 0,
             'gcc_version': 48,
             'host_arch': 'x64',
             'icu_small': 'false',
             'node_install_npm': 'true',
             'node_prefix': '/home/durrantm/local',
             'node_shared_cares': 'false',
             'node_shared_http_parser': 'false',
             'node_shared_libuv': 'false',
             'node_shared_openssl': 'false',
             'node_shared_v8': 'false',
             'node_shared_zlib': 'false',
             'node_tag': '',
             'node_use_dtrace': 'false',
             'node_use_etw': 'false',
             'node_use_mdb': 'false',
             'node_use_openssl': 'true',
             'node_use_perfctr': 'false',
             'openssl_no_asm': 0,
             'python': '/usr/bin/python',
             'target_arch': 'x64',
             'uv_library': 'static_library',
             'uv_parent_path': '/deps/uv/',
             'uv_use_dtrace': 'false',
             'v8_enable_gdbjit': 0,
             'v8_enable_i18n_support': 0,
             'v8_no_strict_aliasing': 1,
             'v8_optimized_debug': 0,
             'v8_random_seed': 0,
             'v8_use_snapshot': 'true',
             'want_separate_host_toolset': 0}}
creating  ./config.gypi
creating  ./config.mk
$ make
...
$ make install
...
但这似乎没有帮助:

$ npm install -g appium
npm ERR! tar.unpack untar error /home/durrantm/.npm/appium/1.3.7/package.tgz
npm ERR! Linux 3.13.0-49-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "appium"
npm ERR! node v0.12.2
npm ERR! npm  v2.7.4
npm ERR! path /usr/local/lib/node_modules/appium
npm ERR! code EACCES
npm ERR! errno -13

npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/appium'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, mkdir '/usr/local/lib/node_modules/appium']
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/appium',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/local/lib/node_modules/appium',
npm ERR!   fstream_class: 'DirWriter',
npm ERR!   fstream_stack: 
npm ERR!    [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR!      '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR!      'FSReqWrap.oncomplete (fs.js:95:15)' ] }
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!     /home/durrantm/Downloads/node/npm-debug.log
15:47:13 durrantm Castle2012 /home/durrantm/Downloads/node master
$ appium 
error: Appium will not work if used or installed with sudo. Please rerun/install as a non-root user. 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 doesn't require sudo to install global npm packages.
我也有

sudo chown -R $(whoami) ~/.npm

但我还是明白了

$ appium
error: Appium will not work if used or installed with sudo. Please rerun/install as a non-root user. 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 doesn't require sudo to install global npm packages.

正如您已经提到的,Appium不应与sudo一起安装。 我不建议您通过apt安装node,这对我不起作用

更好地使用自制-这将允许您在不使用sudo的情况下将Appium安装到主目录。请尝试以下操作:

  • 卸载以前与apt一起安装的node
    sudo-apt-get-remove-node

  • 按照说明和步骤进行操作。之后,使用:
    brew安装节点安装node

  • 现在尝试:
    npm安装-g appium

  • 如果您在主路径中遇到.npm文件夹的权限问题,请使用您提到的
    sudo chown-R$(whoami)~/.npm

    sudo chown -R $(whoami) ~/.npm
    
    sudo npm install -g appium
    
    ...
    lots of compile outpout, not errors, seems ok
    ...
    
    $ appium
    error: Appium will not work if used or installed with sudo. Please rerun/install as a non-root user. 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 doesn't require sudo to install global npm packages.