1

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.

Poussy
  • 85
  • 4

1 Answers1

0

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 called apt is used for installing software.

Check the npm documentation on how to install nom on your Mac, as there are different ways to do it.

Once npm is installed, run sudo npm install -g express-generator (no apt 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.

Mirko Raimo
  • 1,469
  • 1
  • 12
  • 19