Next.js Discord

Discord Forum

Found lockfile missing swc dependencies, patching...

Unanswered
Cape lion posted this in #help-forum
Open in Discord
Cape lionOP
I'm having an issue where I constantly have package-lock.json diffs pop up when running our company's next server. When running the server I get a warning in the console:
warn  - Found lockfile missing swc dependencies, patching...

warn  - Lockfile was successfully patched, please run "npm install" to ensure @next/swc dependencies are downloaded

This isn't happening to anyone else on my team. I believe it started happening when we upgraded from Node 16 to 20 recently. The entire company uses Macbook Pro machines, but probably all slightly different year models.

I've tried deleting package-lock.json and node_modules and rerunning npm i - even tried a cache clean in between, several times. I've also tried nuking the repo entirely and recloning. Nothing seems to fix the issue. I'm attaching screenshots of the diffs. The first four are in the middle of the lockfile, the last two are at the bottom.

11 Replies

Cape lionOP
Bump
heya is the server behaving weirdly or is it just a warning that doesn't actually affect anything?
from what I could tell since everyone in the company uses MacBook it might be that the package-lock.json only contained an arm64 swc binary since that's what's only needed for it to be able to run on an apple silicon chips (and seeing from your screenshots, there's no @next/swc-darwin-arm64 that got patched by npm running on the server)
when deployed on the server (i assume it's linux-based), it discovered that there are missing swc binary dependencies (other system/architectures' binaries), so it added them into the package-lock.json and asked to be npm install-ed
weirdly enough on my linux system, npm listed every possible swc binaries for every architecture and systems on package-lock.json, only for it to fail when npm install-ed:
perhaps it's a some kind of quirk on linux systems where it'll need to have the dependencies listed on package-lock.json even when it failed to resolve when npm install-ed?
@iyxan23 heya is the server behaving weirdly or is it just a warning that doesn't actually affect anything?
Cape lionOP
I think it's not really affecting anything from what I can tell, but it feels weird to constantly have to keep package-lock.json out of my commits. I'm digging into the source code trying to understand why my machine would be acting differently than others. I really don't think mine is the only M1 chip.
I discovered there is an env you can use to bypass NEXT_IGNORE_INCORRECT_LOCKFILE but again this feels wrong
Cape lionOP
Looks like upgrading to 13.5.1 fixes the issue, so we're just going to go that route 😅
👍