m0bilesecurity / RMS-Runtime-Mobile-Security

Runtime Mobile Security (RMS) 📱🔥 - is a powerful web interface that helps you to manipulate Android and iOS Apps at Runtime
https://twitter.com/mobilesecurity_
GNU General Public License v3.0
2.62k stars 376 forks source link

Installation issue via npm #51

Closed g33kyshivam closed 3 years ago

g33kyshivam commented 3 years ago

Having issues in installation of tool via npm command Can't install the tool via npm after installing all the prerequisites (frida and node/npm). I have tried with sudo command as well but it doesn't install. I have shared the error message below.

To Reproduce Steps to reproduce the behavior:

  1. sudo npm install -g rms-runtime-mobile-security
  2. See error

Desktop (please complete the following information):

Console Logs

npm WARN deprecated babel-preset-es2015@6.24.1: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please read https://babeljs.io/env to update!
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
/usr/bin/RMS-Runtime-Mobile-Security -> /usr/lib/node_modules/rms-runtime-mobile-security/rms.js
/usr/bin/rms -> /usr/lib/node_modules/rms-runtime-mobile-security/rms.js

> frida@14.1.3 install /usr/lib/node_modules/rms-runtime-mobile-security/node_modules/frida
> prebuild-install || node-gyp rebuild

prebuild-install WARN install EACCES: permission denied, access '/root/.npm'
gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/root/.cache/node-gyp/14.15.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/rms-runtime-mobile-security/node_modules/frida/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/rms-runtime-mobile-security/node_modules/frida/.node-gyp'
gyp ERR! System Linux 5.4.0-58-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/lib/node_modules/rms-runtime-mobile-security/node_modules/frida
gyp ERR! node -v v14.15.2
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/rms-runtime-mobile-security/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frida@14.1.3 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the frida@14.1.3 install script.
g33kyshivam commented 3 years ago

Development(Local) installation works :-)

m0bilesecurity commented 3 years ago

hey @g33kyshivam, It's for sure a permissions issue with your npm installation. By searching on google it seems a common issue 😉 (try to install RMS by adding the --unsafe parameter).

Best

sidahmed-malaoui commented 3 years ago

If you have installed nodejs via snap, you'll get this error because snap packages are not allowed to write to /usr/local (check this link)

In this case, to install npm packages correctly (including RMS), you need the following configuration :

mkdir ~/.local/npm
npm config set prefix "$HOME/.local/npm"
export PATH=~/.local/npm/bin:$PATH
printf '\nexport PATH=~/.local/npm/bin:$PATH' >> ~/.bashrc  # Or prepend it to ~/.zshrc if you use zsh

npm config set scripts-prepend-node-path true

Now you can install rms with npm, and everything will go fine:

npm install -g rms-runtime-mobile-security
rms
rahulkankrale commented 1 year ago

sudo chown -R $USER /usr/local/bin sudo chown -R $USER /usr/local/lib/node_modules

Worked for me