【问题标题】:Can't build production package无法构建生产包
【发布时间】:2018-03-13 16:58:34
【问题描述】:
  • NPM 版本(npm --v):5.4.2

  • Gulp 版本(gulp -v):CLI@1.4.0,Local@3.9.1

  • JHipster 版本:4.6.1

  • 节点版本:6.11.3

我无法构建生产包。运行应用程序可以顺利完成,使用“dev”配置文件构建包也是如此。

由于某种原因,当我在项目的根目录上运行“.\mvnw -Pprod package”时,我收到此错误:

[INFO] [17:15:22] Starting 'inject:vendor'...
[INFO] [17:15:22] Starting 'ngconstant:prod'...
[INFO] [17:15:22] Starting 'copy:languages'...
[ERROR] events.js:160
[ERROR]       throw er; // Unhandled 'error' event
[ERROR]       ^
[ERROR]
[ERROR] Error: File not found with singular glob: D:\GitHub\Agora\AgoraWeb\src\main\webapp\.htaccess
[ERROR]     at Glob.<anonymous> (D:\GitHub\Agora\AgoraWeb\node_modules\glob-stream\index.js:41:11)
[ERROR]     at Glob.g (events.js:292:16)
[ERROR]     at emitOne (events.js:96:13)
[ERROR]     at Glob.emit (events.js:188:7)
[ERROR]     at Glob._finish (D:\GitHub\Agora\AgoraWeb\node_modules\glob-stream\node_modules\glob\glob.js:172:8)
[ERROR]     at done (D:\GitHub\Agora\AgoraWeb\node_modules\glob-stream\node_modules\glob\glob.js:159:12)
[ERROR]     at Glob._processSimple2 (D:\GitHub\Agora\AgoraWeb\node_modules\glob-stream\node_modules\glob\glob.js:652:12)
[ERROR]     at D:\GitHub\Agora\AgoraWeb\node_modules\glob-stream\node_modules\glob\glob.js:640:10
[ERROR]     at Glob._stat2 (D:\GitHub\Agora\AgoraWeb\node_modules\glob-stream\node_modules\glob\glob.js:736:12)
[ERROR]     at lstatcb_ (D:\GitHub\Agora\AgoraWeb\node_modules\glob-stream\node_modules\glob\glob.js:728:12)
[ERROR]     at RES (D:\GitHub\Agora\AgoraWeb\node_modules\inflight\inflight.js:31:16)
[ERROR]     at f (D:\GitHub\Agora\AgoraWeb\node_modules\once\once.js:25:25)
[ERROR]     at FSReqWrap.oncomplete (fs.js:123:15)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.257 s
[INFO] Finished at: 2017-10-02T17:15:22+02:00
[INFO] Final Memory: 38M/467M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:gulp (gulp build) on project agora: Failed to run task: 'gulp build --no-notification' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [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/MojoFailureException

我明白它在告诉我什么,我错过了 .htaccess 文件,但我以前从未需要它。我最近将项目从我的主驱动器移动到备份驱动器,从那时起我无法生成生产包。

如果我在 gulp 需要的地方创建一个空的“.htaccess”,我会收到另一个错误:

[INFO] [17:21:43] Finished 'inject:app' after 2.94 s
[INFO] [17:21:43] Starting 'inject:troubleshoot'...
[INFO] [17:21:43] 'inject:troubleshoot' errored after 1.01 ms
[INFO] [17:21:43] Error: Invalid glob argument:
[INFO]     at Gulp.src (D:\GitHub\Agora\AgoraWeb\node_modules\vinyl-fs\lib\src\index.js:32:11)
[INFO]     at Gulp.troubleshoot (D:\GitHub\Agora\AgoraWeb\gulp\inject.js:61:27)
[INFO]     at module.exports (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\lib\runTask.js:34:7)
[INFO]     at Gulp.Orchestrator._runTask (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\index.js:273:3)
[INFO]     at Gulp.Orchestrator._runStep (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\index.js:214:10)
[INFO]     at Gulp.Orchestrator.start (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\index.js:134:8)
[INFO]     at runNextSet (D:\GitHub\Agora\AgoraWeb\node_modules\run-sequence\index.js:123:15)
[INFO]     at Gulp.onTaskEnd (D:\GitHub\Agora\AgoraWeb\node_modules\run-sequence\index.js:101:4)
[INFO]     at emitOne (events.js:101:20)
[INFO]     at Gulp.emit (events.js:188:7)
[INFO]     at Gulp.Orchestrator._emitTaskDone (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\index.js:264:8)
[INFO]     at D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\index.js:275:23
[INFO]     at finish (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\lib\runTask.js:21:8)
[INFO]     at D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\lib\runTask.js:52:4
[INFO]     at f (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\node_modules\once\once.js:17:25)
[INFO]     at DestroyableTransform.onend (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\node_modules\end-of-stream\index.js:31:18)
[INFO] [17:21:43] 'build' errored after 3.98 s
[INFO] [17:21:43] Error in plugin 'run-sequence(inject:troubleshoot)'
[INFO] Message:
[INFO]     Invalid glob argument:
[INFO] Stack:
[INFO] Error: Invalid glob argument:
[INFO]     at Gulp.src (D:\GitHub\Agora\AgoraWeb\node_modules\vinyl-fs\lib\src\index.js:32:11)
[INFO]     at Gulp.troubleshoot (D:\GitHub\Agora\AgoraWeb\gulp\inject.js:61:27)
[INFO]     at module.exports (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\lib\runTask.js:34:7)
[INFO]     at Gulp.Orchestrator._runTask (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\index.js:273:3)
[INFO]     at Gulp.Orchestrator._runStep (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\index.js:214:10)
[INFO]     at Gulp.Orchestrator.start (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\index.js:134:8)
[INFO]     at runNextSet (D:\GitHub\Agora\AgoraWeb\node_modules\run-sequence\index.js:123:15)
[INFO]     at Gulp.onTaskEnd (D:\GitHub\Agora\AgoraWeb\node_modules\run-sequence\index.js:101:4)
[INFO]     at emitOne (events.js:101:20)
[INFO]     at Gulp.emit (events.js:188:7)
[INFO]     at Gulp.Orchestrator._emitTaskDone (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\index.js:264:8)
[INFO]     at D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\index.js:275:23
[INFO]     at finish (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\lib\runTask.js:21:8)
[INFO]     at D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\lib\runTask.js:52:4
[INFO]     at f (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\node_modules\once\once.js:17:25)
[INFO]     at DestroyableTransform.onend (D:\GitHub\Agora\AgoraWeb\node_modules\orchestrator\node_modules\end-of-stream\index.js:31:18)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.220 s
[INFO] Finished at: 2017-10-02T17:21:43+02:00
[INFO] Final Memory: 36M/367M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:gulp (gulp build) on project agora: Failed to run task: 'gulp build --no-notification' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [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/MojoFailureException

(抱歉,日志太长了)

我尝试了很多方法,包括完全删除 repo 并再次克隆它。我还尝试按照this answer 中的建议清除 NPM 的缓存。在这一点上,我不知道还能尝试什么。

谢谢!!

【问题讨论】:

  • 一旦在 Windows 上我遇到了问题,因为节点安装在 C: 上并且项目在 D: 上,我把所有东西都放在同一个驱动器上并且它工作。哪个版本的节点?
  • 使用节点 6.11.3。但我注意到 jhipster 在项目目录中安装了一个本地节点。我也会尝试将节点移动到备份驱动器,感谢您的帮助! :)
  • 本地节点确实用于产品构建

标签: node.js maven npm jhipster


【解决方案1】:

我已经解决了这个问题。 Gaël Marziou 让我找到了正确的方法来调查 node 或 gulp 的冲突版本。

在测试了本地和全局节点的各种版本之后,我尝试一个一个地禁用 gulp 任务,即使错误消息确实发生了变化,它们都没有真正帮助我。所以我试着弄乱 gulp 版本,这就是答案。

我通过更改 package.json 中的以下行解决了我的问题:

    "gulp": "^3.9.1",

到这里:

    "gulp": "3.9.1",

现在一切都很完美。

非常感谢:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-08-31
    • 1970-01-01
    • 2018-06-20
    • 2020-02-02
    • 1970-01-01
    • 2021-10-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多