Node.js &引用;API致命错误处理程序在后台线程内存不足后返回;当建立一个角度,电子应用程序
我们在节点10.16.0中使用angular 10.2、electron 4.2、electron builder 22.9。 此外,我们还有一个jenkins管道,每次发出请求时都要执行。 此管道创建一个AWS windows实例(t2.large)以下载代码 并生成一个.exe文件。 问题是编译代码时,会弹出以下错误:Node.js &引用;API致命错误处理程序在后台线程内存不足后返回;当建立一个角度,电子应用程序,node.js,jenkins-pipeline,electron-builder,angular10,Node.js,Jenkins Pipeline,Electron Builder,Angular10,我们在节点10.16.0中使用angular 10.2、electron 4.2、electron builder 22.9。 此外,我们还有一个jenkins管道,每次发出请求时都要执行。 此管道创建一个AWS windows实例(t2.large)以下载代码 并生成一个.exe文件。 问题是编译代码时,会弹出以下错误: 致命错误#后台线程内存不足处理后返回API致命错误处理程序。 节点变量--max_old_space_size值为4191.868721008301 MB。 如果手动启动AW
致命错误#后台线程内存不足处理后返回API致命错误处理程序。
节点变量--max_old_space_size值为4191.868721008301 MB
。
如果手动启动AWS windows实例,请运行npm install
并手动生成代码,
未触发任何错误,并且生成完全成功。只有在以下情况下才会发生错误:
jenkins启动AWS windows实例
在--max\u old\u space\u size=1.5GB
的mac环境中,构建过程完全成功。
同样,在windows中手动测试时,如果使用--max\u old\u space\u size=1.5GB
,构建也会很好地完成。
如果变量设置为--max_old_space_size=512MB
,则生成将失败,并出现另一个错误
Javascript内存不足
我猜是和詹金斯的记忆有关吧?但我还没有发现如何增加
线程内存
任何想法、建议都会有帮助
詹金斯档案:
stage ('Build Windows app') {
node('windows-electron') {
// Wipe the workspace so we are building completely clean
deleteDir()
checkout scm
bat """
cd app
call npm run node-memory
call node -v
call npm --no-git-tag-version version \"${version}\"
call npm install
REM call npm run test - tests disabled on Windows for now (they run on Mac OS)
call npm run build"""
}
}
Package.json构建脚本:
“build”:“npm运行下载翻译和ng build--prod&&electron webpack&&electron builder--publish=never”
由于这个问题,从年开始,我们创建一个linux从机来执行构建过程,然后将文件存储并取消存储在mac和windows从机中
node('nvm-slave') {
// Wipe the workspace so we are building completely clean
deleteDir()
checkout scm
nvm(nvmInstallURL: 'https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh', nvmIoJsOrgMirror: 'https://iojs.org/dist', nvmNodeJsOrgMirror: 'https://nodejs.org/dist', version: '10.16.0') {
sh '''cd app
npm install
npx ng build --prod
'''
}
stash name: "folder-to-stash", includes: "path/to/folder/to/stash/**"
}
stage ('Build Windows app') {
node('windows-electron') {
// Wipe the workspace so we are building completely clean
deleteDir()
checkout scm
unstash "folder-to-stash"
bat """
cd app
call node -v
call npm --no-git-tag-version version \"${version}\"
call npm install
REM call npm run test - tests disabled on Windows for now (they run on Mac OS)
call npm run postbuild"""
archiveArtifacts 'app/dist/*.exe'
}
}
Package.json
脚本:
"build": "ng build --prod",
"postbuild": "electron-webpack && electron-builder --x64 --publish=never",