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
apttool in Java, but it's gone now. Your mistake is using the linux command line. On many linux systems, another tool calledaptis used for installing software.Check the
npmdocumentation on how to installnomon your Mac, as there are different ways to do it.Once
npmis installed, runsudo npm install -g express-generator(noapthere).
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
aptthat 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_homeis 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.