NPM upgrade for Meshcentral on Debian 12 LXC fails with platform mismatch

I’m stuck trying to update my Meshcentral server on a Debian 12 LXC. The GUI updates worked fine until version 1.1.35, but now they’re not working at all.

I tried using NPM directly on the VM to update, but it seems to be looking for the Windows build even though I’m on Linux. Here’s a snippet from the error log:

verbose stack Error: Unsupported platform
verbose stack     at checkPlatform (/usr/lib/node_modules/npm/node_modules/npm-install-checks/lib/index.js:55:25)
error code EBADPLATFORM
error notsup Unsupported platform for [email protected]: wanted {"os":"win32"} (current: {"os":"linux"})
error notsup Valid os:  win32
error notsup Actual os: linux

I’ve tried updating to different versions, but I keep getting the same error. It looks like NPM is misreporting the platform my server is running on.

This setup has been working great for the past 4 years across different OSes and configs. I’m not an NPM expert, so I might be missing something obvious.

Has anyone else run into this issue or know how to fix it? I couldn’t find any info about this problem online. Any help would be great!

I’ve dealt with this exact headache before. Sounds like npm’s getting its wires crossed about your system. Here’s what worked for me:

First, try forcing npm to use the correct platform:

npm config set platform linux
npm config set arch x64

Then, clear out your npm cache and do a fresh install:

npm cache clean -f
npm install

If that doesn’t do the trick, you might need to get your hands dirty. Backup your Meshcentral data, then nuke the entire npm installation:

rm -rf node_modules
rm package-lock.json

Then reinstall everything from scratch:

npm install

It’s a pain, but it usually sorts out these weird platform mismatch issues. Just make sure you’ve got a good backup before you start. Good luck!

hey there, i had a similar issue. try clearing npm cache with ‘npm cache clean --force’ and then run ‘npm rebuild’. sometimes npm gets confused about platforms. if that doesnt work, you could try manually removing the node_modules folder and reinstalling. good luck!

I encountered a similar platform mismatch issue when upgrading Meshcentral on Debian. The problem lies in npm’s dependency resolution. To resolve this, you might need to explicitly specify the platform during installation.

Try running:

npm install --target_platform=linux --target_arch=x64

This forces npm to fetch Linux-compatible packages. If that doesn’t work, consider using Node Version Manager (nvm) to switch to a different Node.js version compatible with your Meshcentral version.

As a last resort, you could try a clean installation by backing up your Meshcentral data, uninstalling completely, and then reinstalling from scratch. This approach often resolves stubborn upgrade issues.