[ERROR] native-run was not found on your PATH. Please install it globally:

I constantly get this error when I run the code ionic cordova run android,

[ERROR] native-run was not found on your PATH. Please install it globally:
npm i -g native-run

Even though I got this,

Ionic:

Ionic CLI : 5.0.2 (/usr/local/lib/node_modules/ionic)
Ionic Framework : @ionic/angular 4.5.0
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1

Cordova:

Cordova CLI : 9.0.0 (cordova-lib@9.0.1)
Cordova Platforms : not available
Cordova Plugins : not available

Utility:

cordova-res : 0.3.0
native-run : 0.2.5

System:

Android SDK Tools : 26.1.1 (/Users/Camila/Library/Android/sdk/)
NodeJS : v12.4.0 (/usr/local/Cellar/node/12.4.0/bin/node)
npm : 6.9.0
OS : macOS Mojave

Which means that native-run is installed, but I don’t have it on my path?

I need to fix this, because I want to emulate my app from VS code and I think it has to be in order to publish my anroid app.

1 Like

Install native-run globaly, use this command: npm i -g native-run

2 Likes

I have tried that, but it doesn’t work.

Try this ‘npm i -g native-run’ its 100% working;

I did the same just now, seems there are blank spaces between native and run;
Good luck mate

I have tried that. It will install native-run, as I can see by running “ionic info”, but I cannot use native-run in VS code.

Form me, show erro:

npm WARN npm npm does not support Node.js v10.16.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can’t make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
WARNING: You are likely using a version of node-tar or npm that is incompatible with this version of Node.js.
Please use either the version of npm that is bundled with Node.js, or a version of npm (> 5.5.1 or < 5.4.0) or node-tar (> 4.0.1) that is compatible with Node.js 9 and above.
npm[17920]: c:\ws\src\node_zlib.cc:551: Assertion `args.Length() == 7 && “init(windowBits, level, memLevel, strategy, writeResult, writeCallback,” " dictionary)"’ failed.
1: 00007FF70EB9C6AA v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4506
2: 00007FF70EB77416 node::MakeCallback+4534
3: 00007FF70EB774CF node::MakeCallback+4719
4: 00007FF70EAD653D v8::internal::ParseInfo::end_position+93005
5: 00007FF70F0A4382 std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+79442
6: 00007FF70F0A580D std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+84701
7: 00007FF70F0A4866 std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+80694
8: 00007FF70F0A474B std::vector<v8::internal::compiler::MoveOperands * __ptr64,v8::internal::ZoneAllocator<v8::internal::compiler::MoveOperands * __ptr64> >::_Umove+80411
9: 00000385C6EDC5C1

I have the same problem. I test successful in Windows and not in MacOs…So sad for waiting !!!

Hi mate, just encountered the same problem, did u fix it?

I got it fixed by, just running npm i native-run without global.

run this command if you are on mac
“sudo npm i -g native-run”
it will work .

Try

yarn global add native-run

This solved for me.

Hi Dear Camilandia you have to install ionic and cordova globaly in your installation directory as mine c
and native-run is needed to install ones to run your ionic 4 application,

cheers!!

Gotta know where your native-run binary(executable) is located
My setup is a tad bit different because I ran into a solution in Stackoverflow/Stackexchange that moved the npm global directory to somewhere else but sadly I wasn’t even able to bookmark that solution.

I found stuff at /usr/local/lib/node_modules/ but I’m not sure if this is the global directory
In any case if there is a native-run folder within this directory then you’re in luck

To check if it’s in there, do a ls /usr/local/lib/node_modules
NOTE: ls command is something like dir command in windows which lists all files and folders within the specified place/directory
The output should somehow be like cordova ionic npm native-run. The most important part is that it contains native-run

If this is the case then we should check if native-run contains what we need which is the binary(executable). We can do this by doing ls /usr/local/lib/node_modules/native-run/bin

If the output is “native-run” and not something like “No such file or directory” then good, we can solve this problem by changing the $PATH variable by using nano, a command line text editor
sudo nano /etc/paths

Be wary that nano is not like your conventional text editor but here are the basics:
control button + O = Save
control button + X = Exit
Doing exit before saving will prompt you to ask if you want to save the file. Pressing Y will respond with yes and pressing N will respond with no while control button + C = cancel

Now within the /etc/paths file you should see something like:

/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin

Just go to a newline and add /usr/local/lib/node_modules/native-run/bin
CTRL + O to save then CTRL + X to exit

Now open a new terminal because the new path will only take effect on new terminal instances.
Time for the party, ionic cordova run android
I hope that helped, cheers!

On a side note, why do I know all this? Because linux is love, linux is life
learning how to use the linux command line/terminal will make going around macOS easier than a walk in the park since both are UNIX-based operating systems :sunglasses:

You can find how I solved it in part 3 of this video series

Look at the link I shared in this thread

Very informative, but what do I do if I don’t see native-run when I run ls “/usr/local/lib/node_modules”?
I’ve ran npm i -g native-run many times. Always says the package is being added, but clearly it is not…

Interesting, if that’s the case then it may be that the package really isn’t being added.

Surely you’ve used sudo with “npm i -g native-run”?

If not, try performing the command

sudo npm i -g native-run

I’m not that very knowledgeable in the file system setup of mac in comparison to Linux and I mainly use linux over mac and the usual case for linux is that putting stuff into /usr/local would require root privileges.

Any command ran with “sudo” runs with root privileges and this is why I need to know if you ever ran that command with “sudo”. And if we’re ever going to make your native-run work then we definitely need to at least have the installation succeed and fix any problems along the way.

Yes I’ve ran ‘sudo npm i -g native-run’ many times, still with no suffice. I’ve asked on StackOverflow and it still seems to be a mystery. All other packages and plugins are all added correctly without issue.

When I run npm i -g native-run, this is what I see in the console: npm i -g native-run
/Users/user/.npm-global/bin/runjs -> /Users/user/.npm-global/lib/node_modules/run/cli.js

  • native@0.3.3
  • run@1.4.0
    added 40 packages from 29 contributors in 6.499s

And then when I try to run: ionic cordova run android - I see the same error message that it was not found in my path. Sad times :frowning:

When I run “ionic info” I see in Utility, native-run and cordova-res are both installed.

1 Like

Hey again! Sorry, my video was cut by youtube, so I cover this issue in part 3, which is
in this link https://www.youtube.com/watch?v=D5hBjBjjBy8&t=39s

“ionic cordova run android --no-native-run” is a neat hack that forces it to work.

I also had native run installed, but it didn’t want to run. This wasn’t a really important part to solve in order for me to upload the app to android.

Avoid SUDO! Also you could download the node and npm I downloaded to avoid sudo.

I really hope that this helped you (:

Using the ‘–no-native-run’ flag is more of a workaround and not a solution. I’ve used this previously and can notice the slowness in app performance when running on a native Android device, for example there is a seconds delay when the splashscreen transitions to the root page where the screen is blank white and it looks choppy.

I’ve skimmed through your video and I think the workaround is the only thing you try in the video.

Can you confirm that when you upload the app to android you see no performance related issues, like the one that I have noticed?

Thanks for the response.