Skip to content

Conversation

niklaswallerstedt
Copy link
Contributor

@niklaswallerstedt niklaswallerstedt commented Sep 24, 2025

Resolves a problem where sharp after 0.36.2 would not install correctly.

  • uses --os instead of platform
    - updates sharpto latest version

Copy link

changeset-bot bot commented Sep 24, 2025

🦋 Changeset detected

Latest commit: af863e0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@opennextjs/aws Patch
app-pages-router Patch
app-router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR


const additionalArgs = installOptions.additionalArgs ?? "";
const installCommand = `npm install --platform=linux ${archOption} ${targetOption} ${libcOption} ${additionalArgs} ${installOptions.packages.join(" ")}`;
const installCommand = `npm install --os=linux ${archOption} ${targetOption} ${libcOption} ${additionalArgs} ${installOptions.packages.join(" ")}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should provide both if it does not cause any issue, not just replace it

Copy link
Contributor

@vicb vicb Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@conico974 It looks like there is no --platform option. What about updating the code to use --os=${os.platform()}

It looks like it would help with local e2e on Mac

/cc @sommeeeer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://sharp.pixelplumbing.com/install/#npm-v10 (kudos to Magnus for finding that link)

Copy link
Contributor

@sommeeeer sommeeeer Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could introduce another optional parameter to InstallOptions that is os and defaults to linux. Then here we set it to what you suggested if the config.imageOptimization.loader is fs-dev. WDYT?

Update: However, does glibc work on macOS?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to your idea @sommeeeer

We could also detect the CPU (i.e. arm64 vs x64)

Update: However, does glibc work on macOS?

I'll test and report.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember when we added the --platform options TBH, it's a very old one.
I'm fine with adding the os option.
Autodetecting is something that we need to be able to override though, this could break some deployment otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, been busy with other things and haven't gotten round to this PR. But if I understand correctly, autodetecting would break my deployment since I usually deploy through GitHub actions but on rare occasions I've had to deploy from local to fix issues.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What they suggest is only if you use the fs-dev image loader (which is likely not your case).
But even in this case I think that if the user provide some options we should respect it

Copy link

pkg-pr-new bot commented Sep 24, 2025

Open in StackBlitz

pnpm add https://pkg.pr.new/@opennextjs/aws@985

commit: 145beb3

Copy link
Contributor

@vicb vicb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR and updates @niklaswallerstedt.

I have rebased the PR and squashed the commits.

I'll go ahead and merge this fix (--platform seems to never have existed but should be --os).

We'll address the follow up discussed in the comments in #971 as it is where those are needed.

@vicb
Copy link
Contributor

vicb commented Oct 9, 2025

The pre-releasing step fails... merging anyway

@vicb vicb merged commit 9018704 into opennextjs:main Oct 9, 2025
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants