首页 > 解决方案 > MAVEN 构建失败对节点权限被拒绝

问题描述

在本地构建我的项目时,我遇到了 UI 应用程序的构建失败,似乎与 NPM 有关。不确定它是否与 Node 或有关 JDK 的一些 Java 问题有关。关于这个问题的任何信息?

我必须更改一些内部权限配置吗?

sh: /Users/test.gc/Desktop/git/test-dot-com/test-dot-com/ui.apps/node_modules/.bin/npm-run-all: Permission denied

[ERROR] Command execution failed.

org.apache.commons.exec.ExecuteException: Process exited with an error: 126 (Exit value: 126)

    at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)

    at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)

    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:804)

    at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:751)

    at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:313)

    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)

    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)

    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)

    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)

    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)

    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)

    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)

    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)

    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)

    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)

    at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)

    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)

    at java.lang.reflect.Method.invoke (Method.java:498)

    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)

    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)

    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)

    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Summary for jll-dot-com 21.5.0:

[INFO] 

[INFO] jll-dot-com ........................................ SUCCESS [  0.246 s]

[INFO] jll-dot-com - Core ................................. SUCCESS [ 15.429 s]

[INFO] jll-dot-com - Groovy Console Extension ............. SUCCESS [  0.933 s]

[INFO] jll-dot-com - UI apps .............................. FAILURE [  8.991 s]

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time:  26.590 s

[INFO] Finished at: 2021-05-10T08:57:09-07:00

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (npm-run-build) on project jll-dot-com.ui.apps: Command execution failed.: Process exited with an error: 126 (Exit value: 126) -> [Help 1]

[ERROR] 

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR] 

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

[ERROR] 

[ERROR] After correcting the problems, you can resume the build with the command

[ERROR]   mvn <args> -rf :jll-dot-com.ui.apps

完成此构建而没有失败的步骤是什么。

标签: javamavennpmbuildaem

解决方案


sh: /Users/test.gc/Desktop/git/test-dot-com/test-dot-com/ui.apps/node_modules/.bin/npm-run-all: Permission denied

第一行说明了一切。

我建议你尝试直接在代码仓库中使用 npm 运行相同的命令,看看你获得了什么样的权限。

npx npm-run-all

每个文件有 3 个属性:Read、Write 和 Execute

total 0
0 drwx------@  6 samuel  staff   192 Apr 27 17:28 Applications

您可能没有执行该文件的权限。这可能是由许多可能的原因引起的。例如,如果您下载,则复制并粘贴它们。如果权限问题确实是权限不足导致的,请使用以下命令更改权限。

chmod +x YOUR_REPO_DIR/.bin/*

这将授予命令的执行权限。


推荐阅读