When I run
sudo apt install gzip
I get the following error:
Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk-11.0.4.jdk/Contents/Home/bin/apt" (-1)
None of the solutions from other questions solves the problem.
I think that the apt tool is not present anymore in the java version you have.
Try using referece
npm install node-gzip --save
I suggest you read the original answer given by @Axel to a similar question.
For simplicity, I quote it here:
Sorry, I just saw what's wrong...
There used to be an
apt
tool in Java, but it's gone now. Your mistake is using the linux command line. On many linux systems, another tool calledapt
is used for installing software.Check the
npm
documentation on how to installnom
on your Mac, as there are different ways to do it.Once
npm
is installed, runsudo npm install -g express-generator
(noapt
here).
Explanation of the error message
The Java apt-tool was removed in JDK 8. But as JAVA_HOME/bin is normally not on your PATH on Mac, apple provides simple wrappers for all the commands under JAVA_HOME. There still is such a wrapper for
apt
that tries to run a program with the same name from your Java installation. That's why you get that error message.conflict between the pre-installed macOS Java-Version and the Orcalce Java-Version:
Apple stopped pre-installing Java in macOS 10.7 so this should not be an issue.
difference between java_home and JAVA_HOME:
JAVA_HOME is an environment variable that points to your Java installation.
java_home
is a utility program in macOS that makes it easier to correctly set up your JAVA_HOME by listing installed Java versions and the values to use for JAVA_HOME.