linux - 在 Linux 上使用 Angular4 构建 JHipster 时出现问题

标签 linux jenkins jhipster

我正在尝试使用 Jenkins 在服务器端构建我的应用程序。运行命令时: **sudo ./mvnw -Pprod 包* 我收到以下错误消息:

[INFO] --- frontend-maven-plugin:1.6:yarn (webpack build prod) @ timetrack ---
[INFO] Running 'yarn run webpack:prod' in /var/lib/jenkins/workspace/timetrack-jh
[INFO] yarn run v1.2.1
[INFO] $ yarn run cleanup && yarn run webpack:prod:main && yarn run clean-www
[ERROR] warning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded. In a future version, any explicit "--" will be forwarded as-is to the scripts.
[ERROR] module.js:471
[ERROR]     throw err;
[ERROR]     ^
[ERROR]
[ERROR] Error: Cannot find module '/var/lib/jenkins/workspace/timetrack-jh/webpack/webpack.prod.js'
[ERROR]     at Function.Module._resolveFilename (module.js:469:15)
[ERROR]     at Function.Module._load (module.js:417:25)
[ERROR]     at Module.require (module.js:497:17)
[ERROR]     at require (internal/module.js:20:19)
[ERROR]     at requireConfig (/var/lib/jenkins/workspace/timetrack-jh/node_modules/webpack/bin/convert-argv.js:97:18)
[ERROR]     at /var/lib/jenkins/workspace/timetrack-jh/node_modules/webpack/bin/convert-argv.js:104:17
[ERROR]     at Array.forEach (native)
[ERROR]     at module.exports (/var/lib/jenkins/workspace/timetrack-jh/node_modules/webpack/bin/convert-argv.js:102:15)
[ERROR]     at yargs.parse (/var/lib/jenkins/workspace/timetrack-jh/node_modules/webpack/bin/webpack.js:171:41)
[ERROR]     at Object.Yargs.self.parse (/var/lib/jenkins/workspace/timetrack-jh/node_modules/webpack/node_modules/yargs/yargs.js:533:18)
[ERROR] error Command failed with exit code 1.
[ERROR] error Command failed with exit code 1.
[ERROR] error Command failed with exit code 1.
[INFO] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------*

我在我的 Windows 机器上完成了相同的构建并且工作正常。有人可以帮助我了解 Linux 系统上发生了什么吗?

Linux 版本:Linux 版本 4.10.0-37-generic (buildd@lgw01-amd64-022) (gcc 版本 6.3.0 20170406 (Ubuntu 6.3.0-12ubuntu2) ) #41-Ubuntu SMP Fri Oct 6 20: 2017 年世界协调时间 20:00

提前致谢

-杆

经过一些处理,我解决了上面的问题,但它仍然存在,并有一个新的错误消息如下(仅在 Linux 上,Windows 运行良好):

[INFO] Installed Yarn locally.
[INFO]
[INFO] --- frontend-maven-plugin:1.6:yarn (yarn install) @ timetrack ---
[INFO] Running 'yarn install' in /home/rodrigo/test/TimeTrack
[INFO] yarn install v1.2.1
[INFO] [1/5] Validating package.json...
[INFO] [2/5] Resolving packages...
[INFO] [3/5] Fetching packages...
[INFO] info fsevents@1.1.2: The platform "linux" is incompatible with this modul                       e.
[INFO] info "fsevents@1.1.2" is an optional dependency and failed compatibility                        check. Excluding it from installation.
[INFO] [4/5] Linking dependencies...
[ERROR] warning "bootstrap@4.0.0-beta" has unmet peer dependency "popper.js@^1.1                       1.0".
[ERROR] warning "@schematics/angular@0.0.49" has incorrect peer dependency "@ang                       ular-devkit/schematics@0.0.34".
[ERROR] warning "license-webpack-plugin@1.1.1" has unmet peer dependency "webpac                       k-sources@>=1.0.0".
[INFO] [5/5] Building fresh packages...
[INFO] Done in 40.25s.
[INFO]
[INFO] --- frontend-maven-plugin:1.6:yarn (webpack build prod) @ timetrack ---
[INFO] Running 'yarn run webpack:prod' in /home/rodrigo/test/TimeTrack
[INFO] yarn run v1.2.1
[INFO] $ yarn run cleanup && yarn run webpack:prod:main && yarn run clean-www
[ERROR] warning From Yarn 1.0 onwards, scripts don't require "--" for options to                        be forwarded. In a future version, any explicit "--" will be forwarded as-is to                        the scripts.
[INFO]
[INFO] <--- Last few GCs --->
[INFO]
[INFO]       28 ms: Mark-sweep 1.4 (5.5) -> 1.3 (5.5) MB, 1.2 / 0.0 ms [allocati                       on failure] [GC in old space requested].
[INFO]       29 ms: Mark-sweep 1.3 (5.5) -> 1.3 (5.5) MB, 1.2 / 0.0 ms [allocati                       on failure] [GC in old space requested].
[INFO]       30 ms: Mark-sweep 1.3 (5.5) -> 1.3 (5.5) MB, 1.2 / 0.0 ms [allocati                       on failure] [GC in old space requested].
[INFO]       32 ms: Mark-sweep 1.3 (5.5) -> 1.3 (4.5) MB, 1.2 / 0.0 ms [last res                       ort gc].
[INFO]       33 ms: Mark-sweep 1.3 (4.5) -> 1.3 (4.5) MB, 1.2 / 0.0 ms [last res                       ort gc].
[INFO]
[INFO]
[INFO] <--- JS stacktrace --->
[INFO]
[INFO] ==== JS stack trace =========================================
[INFO]
[INFO] Security context: 0x3957b609 <JS Object>
[INFO]     1: /* anonymous */(aka /* anonymous */) [fs.js:10] [pc=0x29d1d25d] (t                       his=0x395081d9 <undefined>,exports=0x3d777f45 <an Object with map 0x4e409cad>,re                       quire=0x39585bf1 <JS Function NativeModule.require (SharedFunctionInfo 0x3958425                       d)>,module=0x3d777f11 <a NativeModule with map 0x4e40e2a1>,__filename=0x3d777f31                        <String[5]: fs.js>,__dirname=0x395081d9 <undefined>)
[INFO]     2: arguments adaptor frame: 4-...
[INFO]
[ERROR] FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out                        of memory
[ERROR]  1: node::Abort() [node]
[ERROR]  2: 0x8c80076 [node]
[ERROR]  3: v8::Utils::ReportApiFailure(char const*, char const*) [node]
[ERROR]  4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
[ERROR]  5: v8::internal::Factory::NewMap(v8::internal::InstanceType, int, v8::i                       nternal::ElementsKind) [node]
[ERROR]  6: v8::internal::Map::RawCopy(v8::internal::Handle<v8::internal::Map>,                        int) [node]
[ERROR]  7: v8::internal::Map::CopyDropDescriptors(v8::internal::Handle<v8::inte                       rnal::Map>) [node]
[ERROR]  8: v8::internal::Map::CopyReplaceDescriptors(v8::internal::Handle<v8::i                       nternal::Map>, v8::internal::Handle<v8::internal::DescriptorArray>, v8::internal                       ::Handle<v8::internal::LayoutDescriptor>, v8::internal::TransitionFlag, v8::inte                       rnal::MaybeHandle<v8::internal::Name>, char const*, v8::internal::SimpleTransiti                       onFlag) [node]
[ERROR]  9: v8::internal::Map::CopyAddDescriptor(v8::internal::Handle<v8::intern                       al::Map>, v8::internal::Descriptor*, v8::internal::TransitionFlag) [node]
[ERROR] 10: v8::internal::Map::CopyWithConstant(v8::internal::Handle<v8::interna                       l::Map>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<v8::inte                       rnal::Object>, v8::internal::PropertyAttributes, v8::internal::TransitionFlag) [                       node]
[ERROR] 11: v8::internal::Map::TransitionToDataProperty(v8::internal::Handle<v8:                       :internal::Map>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<                       v8::internal::Object>, v8::internal::PropertyAttributes, v8::internal::Object::S                       toreFromKeyed) [node]
[ERROR] 12: v8::internal::LookupIterator::PrepareTransitionToDataProperty(v8::in                       ternal::Handle<v8::internal::JSObject>, v8::internal::Handle<v8::internal::Objec                       t>, v8::internal::PropertyAttributes, v8::internal::Object::StoreFromKeyed) [nod                       e]
[ERROR] 13: v8::internal::Object::AddDataProperty(v8::internal::LookupIterator*,                        v8::internal::Handle<v8::internal::Object>, v8::internal::PropertyAttributes, v                       8::internal::Object::ShouldThrow, v8::internal::Object::StoreFromKeyed) [node]
[ERROR] 14: v8::internal::JSObject::AddProperty(v8::internal::Handle<v8::interna                       l::JSObject>, v8::internal::Handle<v8::internal::Name>, v8::internal::Handle<v8:                       :internal::Object>, v8::internal::PropertyAttributes) [node]
[ERROR] 15: v8::internal::Factory::NewFunction(v8::internal::Handle<v8::internal                       ::String>, v8::internal::Handle<v8::internal::Code>, v8::internal::Handle<v8::in                       ternal::Object>, v8::internal::InstanceType, int, bool, bool, bool) [node]
[ERROR] 16: v8::internal::ApiNatives::CreateApiFunction(v8::internal::Isolate*,                        v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v                       8::internal::Object>, v8::internal::ApiNatives::ApiInstanceType) [node]
[ERROR] 17: 0x8554502 [node]
[ERROR] 18: v8::internal::ApiNatives::InstantiateFunction(v8::internal::Handle<v                       8::internal::FunctionTemplateInfo>) [node]
[ERROR] 19: v8::FunctionTemplate::GetFunction(v8::Local<v8::Context>) [node]
[ERROR] 20: v8::FunctionTemplate::GetFunction() [node]
[ERROR] 21: node::InitFs(v8::Local<v8::Object>, v8::Local<v8::Value>, v8::Local<                       v8::Context>, void*) [node]
[ERROR] 22: 0x8c858a0 [node]
[ERROR] 23: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionC                       allbackInfo<v8::Value> const&)) [node]
[ERROR] 24: 0x85b3630 [node]
[ERROR] 25: 0x85b3dd0 [node]
[ERROR] 26: 0x4890a0fe
[ERROR] 27: 0x29d1d25d
[ERROR] 28: 0x4890b616
[ERROR] 29: 0x489384a8
[ERROR] 30: 0x48937d7f
[ERROR] 31: 0x29d1b14f
[ERROR] 32: 0x4890b616
[ERROR] 33: 0x489384a8
[ERROR] 34: 0x48937d7f
[ERROR] 35: 0x48937411
[ERROR] 36: 0x48936335
[ERROR] 37: 0x4893153e
[ERROR] 38: 0x48920a43
[ERROR] 39: v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::                       Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v                       8::internal::Handle<v8::internal::Object>*) [node]
[ERROR] 40: v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int                       , v8::Local<v8::Value>*) [node]
[ERROR] 41: v8::Function::Call(v8::Local<v8::Value>, int, v8::Local<v8::Value>*)                        [node]
[ERROR] 42: node::LoadEnvironment(node::Environment*) [node]
[ERROR] 43: node::Start(int, char**) [node]
[ERROR] 44: main [node]
[ERROR] 45: __libc_start_main [/lib/i386-linux-gnu/libc.so.6]
[ERROR] Aborted (core dumped)
[ERROR] error Command failed with exit code 134.
[ERROR] error Command failed with exit code 1.
[ERROR] error Command failed with exit code 1.
[INFO] info Visit https://yarnpkg.com/en/docs/cli/run for documentation about th                       is command.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:09 min
[INFO] Finished at: 2017-11-14T19:58:35+13:00
[INFO] Final Memory: 31M/74M
[INFO] ------------------------------------------------------------------------

有人帮忙吗?

问候,

-杆

最佳答案

我又想通了这个问题。在 Linux 机器上构建时,Javascript 的堆内存不足。需要更改 package.json 上的那些行(只发生在使用 JHipster 和 Angular 4 时):

"webpack-dev-server": "node --max_old_space_size=5120 node_modules/webpack-dev-server/bin/webpack-dev-server.js", "webpack": "node --max_old_space_size=5120 node_modules/webpack/bin/webpack.js"

我将 --max_old_space_size 从 4096 更新为 5120(增加 1GB)。

伙计们,就是这样!

还是感谢那些帮助过我的好心人

最好的问候,

-杆

关于linux - 在 Linux 上使用 Angular4 构建 JHipster 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47260748/

相关文章:

linux - 键盘快捷键创建 ubuntu

linux - 迁移部署在 Linux VM 上的软件?

java - 将 Java EE Web 应用程序部署到 Wildfly/JBoss EAP

jenkins - 在 Jenkins DSL 中使用 Path 时出现 NotSerializedException

Jhipster 在实体更新后更新假数据 csv 文件

java.lang.NoClassDefFoundError : org/springframework/beans/factory/config/EmbeddedValueResolver

eclipse - 无法在Jipster示例应用程序Gradle中运行Eclipse中的Junits

linux - 使用另一个 bash 命令输出的 bash 命令

Jenkins 管道错误 - 未知阶段部分 "sh"和阶段中的步骤必须在步骤 block 中

c - Linux 的 GCC 替代方案,支持 OpenMP 和带 +、-、*、/和 % 的 128 位整数