-
-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory limit exceeded during ghost install process #1898
Comments
so - adding |
closes TryGhost#1898 - passthrough NODE_OPTIONS env var to yarn install if set
@danieldinter if you have the ability - would you be able to test the change in #1900? I wasn't able to replicate the behavior you're seeing locally, but the change in that PR should allow you to set |
@acburdine thanks for your effort. I tested the PR and the process still gets killed. Looks like the parameter is not passed. What I did:
|
@dani I see a fetch but I don't see a checkout - can you confirm if you're running on main or this PR? |
@vikaspotluri123 yes, indeed, I did a checkout:
Sorry for the confusion. I also see the changes made in |
A problem might be that I first
I tried to install it globally:
Then ran the |
I edited the file // #1898: pass through NODE_OPTIONS so max_old_space_size can be configured
// in memory-constrained environments
console.log("process.env.NODE_OPTIONS: " + process.env.NODE_OPTIONS);
if (process.env.NODE_OPTIONS) {
env.NODE_OPTIONS = process.env.NODE_OPTIONS;
console.log("env.NODE_OPTIONS: " + env.NODE_OPTIONS);
} Running
So the variable is set but it is ignored by |
hmm - thanks for the additional tests/examples @danieldinter I'll look more into what cross-env is doing that makes it work correctly with NODE_OPTIONS. If I can figure out what they're doing under the hood to make the node options accepted by yarn then I'll replicate that in the CLI 👍🏻 |
so I looked a bit further and we're also using cross-spawn under the hood (which cross-env is also using), though likely a rather old version of it. I'll try to replicate the conditions you're experiencing to see if I can get a memory killed error, though I'm having a hard time finding a working copy of a centos7 iso that boots in a vm on my mac 😅 |
Summary
My Ghost blog is running on a virtual machine provided by an internet hosting service. They limit single processes to 1.5 GB memory usage. Processes exceeding 1.5 GB memory are automatically killed.
When I try to upgrade Ghost from v5.86.2 to the recent version (i.e. v5.100.1) using the Ghost CLI, the process is killed due to memory usage during the step that says
Installing dependencies > [5/5] Building fresh packages...
Steps to Reproduce & Log File
I switched away from trying to upgrade my blog (as it fails) to setting up a new blog on a green field on the same machine. That makes testing easier.
$ cd versions/5.100.1/
The messages showing before the kill were:
As it became apparent that memory could be a problem, I tried to set the NODE_OPTIONS parameter
--max-old-space-size=1024
:~/.npmrc
:node-options=--max-old-space-size=1024
However, the parameter is not passed by node to yarn. The builds failed again. Although yarn lists the parameter:
The only way that works is using
cross-env
:That way, the
yarn install
command finishes regularly. However, I cannot continue the Ghost CLI install process from this point, as it tells me the directory is non-empty:Solutions
If I may I like to propose two solutions:
cross-env
to pass node parameters to yarn.Technical details
This is automatically output by Ghost-CLI if an error occurs, please copy & paste:
Bug submission checklist
Please fill out this checklist to acknowledge that you followed the requirements to submit a bug report.
The text was updated successfully, but these errors were encountered: