简体   繁体   English

我在OS X Mavericks上运行mvn时出现以下错误:无法运行程序“/ bin / sh”:error = 2,没有这样的文件或目录

[英]I am getting the following error when I run mvn on OS X Mavericks: Cannot run program “/bin/sh”: error=2, No such file or directory

I am running OS X Mavericks on a MacBook Pro. 我在MacBook Pro上运行OS X Mavericks。

I have maven 3.0.5 installed. 我安装了maven 3.0.5。

When I run mvn, I am getting the following error message. 当我运行mvn时,我收到以下错误消息。

Error while executing process. Cannot run program "/bin/sh": error-2, No such file or directory

And before you ask: 在你问之前:

PATH="/usr/local/apache-maven-3.0.5/bin:/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin:/usr/local/bin:/bin:/usr/bin"

M2_HOME="/usr/local/apache-maven-3.0.5"

M2="/usr/local/apache-maven-3.0.5/bin"

MAVEN_OPTS="-Xms256m -Xmx768m -XX:MaxPermSize=512m"

I am also seeing the following near the beginning of the mvn output: [WARNING] Some problems were encountered while building the effective settings 我也在mvn输出的开头附近看到以下内容:[警告]在构建有效设置时遇到了一些问题

[WARNING] Failed to use environment variables for interpolation: Cannot run program "env": error=0, spawn failed @ 

I had the same problem: exec() failed with ANY executable. 我有同样的问题:exec()失败了任何可执行文件。 Finally remembered that I was using a private jre. 最后记得我正在使用私人jre。 That jre was a copy of the original one, just with bin/java set as executable. 那个jre是原始版本的副本,只是将bin / java设置为可执行文件。

I made lib/jspawnhelper executable and it worked! 我制作了lib / jspawnhelper可执行文件,它工作正常!

It seems your system is missing the "sh" shell to start interpreting the script. 看来你的系统缺少“sh”shell来开始解释脚本。

I just looked up installed shells on Mac OSX and got this result: 我只是在Mac OSX上查找已安装的shell并得到了这个结果:

/bin/zsh
/bin/ksh
/bin/tcsh
/bin/bash
/bin/sh

So when "/bin/sh" is missing, try "/bin/bash" for example. 因此,当缺少“/ bin / sh”时,请尝试使用“/ bin / bash”。

Better: 更好:

  1. Check if "/bin/sh" exist 检查是否存在“/ bin / sh”
  2. If exist check if the user which runs the command can execute the shell 如果存在,请检查运行该命令的用户是否可以执行shell

Because it can be possible that the shell binary exist but isn't executable for you. 因为shell二进制文件可能存在但不可执行。 Then you have to make it executable for the user trying mvn. 然后你必须让用户尝试mvn可执行。

Hope that helps ;) 希望有所帮助;)

If you are using eclipse , this is due to the java version. 如果您使用的是eclipse,这是由于java版本。 point java to your OS java instead of eclipse java. 将java指向你的OS java而不是eclipse java。 this will be solved 这将解决

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法运行程序“mvn”错误=2,没有这样的文件或目录 - Cannot run program "mvn" error=2, No such file or directory java.io.IOException:无法运行程序“/usr/bin/sh”:java.io.IOException:error=2,没有那个文件或目录 - java.io.IOException: Cannot run program “/usr/bin/sh”: java.io.IOException: error=2, No such file or directory java.io.IOException:Cannot run program "sh" (in directory "c:\\cygwin\\bin\\test"):CreateProcess error=2.The system cannot find file specified - java.io.IOException:Cannot run program “sh” (in directory“c:\cygwin\bin\test”):CreateProcess error=2.The system cannot find file specified 在 java 中,出现错误“无法运行程序”/bin/sh“:java.io.IOException: error=24, Too many open files” - in java,getting error “Cannot run program ”/bin/sh“: java.io.IOException: error=24, Too many open files” 当我运行 mvn install 时出现错误 - when i run mvn install ,there is a error 我在编译时没有收到错误,但是当我运行程序时却收到错误 - i am not getting error during compile time but when i run the program i get error java.io.IOException:无法运行程序“usr/bin/ffmpeg”:错误=2,没有那个文件或目录 - java.io.IOException: Cannot run program “usr/bin/ffmpeg ”: error=2, No such file or directory 无法运行程序“ osascript”:error = 2,没有这样的文件或目录 - Cannot run program “osascript”: error=2, No such file or directory 无法运行程序“ docker”,错误= 2,无此文件或目录 - Cannot run program “docker” error=2, No such file or directory 无法运行程序“...”错误= 2,没有这样的文件或目录(java) - Cannot run program “…” error=2, No such file or directory (java)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM