我在一个无服务器/TypeScript项目中的webpack打包步骤遇到了内存问题。
我尝试过:
- 'increase-memory-limit' npm package to no avail
Calling the following command from an npm run script
Calling the following command directly through bitbucket-pipelines.yml.
node --max-old-space-size=4096 ./node_modules/.bin/serverless deploy
这条命令在本地运行良好,但在 Bitbucket 管道中出现以下输出:
Serverless: Bundling with Webpack...
internal/child_process.js:323
throw errnoException(err, 'spawn');
^
Error: spawn ENOMEM
at _errnoException (util.js:1022:11)
at ChildProcess.spawn (internal/child_process.js:323:11)
at exports.spawn (child_process.js:502:9)
at Object.exports.fork (child_process.js:103:10)
at fork (/opt/atlassian/pipelines/agent/build/node_modules/worker-farm/lib/fork.js:17:36)
at Farm.startChild (/opt/atlassian/pipelines/agent/build/node_modules/worker-farm/lib/farm.js:106:16)
at Farm.processQueue (/opt/atlassian/pipelines/agent/build/node_modules/worker-farm/lib/farm.js:279:10)
at Farm.<anonymous> (/opt/atlassian/pipelines/agent/build/node_modules/worker-farm/lib/farm.js:97:21)
at ontimeout (timers.js:475:11)
at tryOnTimeout (timers.js:310:5)
at Timer.listOnTimeout (timers.js:270:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! platform-state-machine-import@0.0.2 deploy: `node --max-old-space-size=4096 ./node_modules/.bin/serverless deploy "--stage" "feattsify" "--region" "us-east-1"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the platform-state-machine-import@0.0.2 deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-02-07T22_37_25_150Z-debug.log
我在谷歌和这里搜索了很多,试图找到Bitbucket是否有可以设置运行时参数等的环境变量,但似乎找不到任何与前面提到的NPM包无关的内容。