nx
nx copied to clipboard
linux-x64 platform not supported
Current Behavior
When running npm ci
on GCP, the build fails with message:
The Nx CLI could not find or load the native binary for your supported platform (linux-x64).
since there is no @nx/nx-linux-64
package (I guess).
Expected Behavior
When encountering linux-x64
, NX could use one of the existing nx-linux-x64-gnu
or nx-linux-x64-musl
packages.
GitHub Repo
No response
Steps to Reproduce
- Create the simplest NX repo
- Deploy on GCP
Nx Report
> NX Falling back to ts-node for local typescript execution. This may be a little slower.
- To fix this, ensure @swc-node/register and @swc/core have been installed
> NX Report complete - copy this into the issue template
Node : 16.20.2
OS : darwin-arm64 ==> local platform works, but CI platform is linux-x64
npm : 8.19.4
nx : 16.8.1
@nx/js : 16.8.1
@nx/jest : 16.8.1
@nx/linter : 16.8.1
@nx/workspace : 16.8.1
@nx/angular : 16.8.1
@nx/cypress : 16.8.1
@nx/devkit : 16.8.1
@nx/eslint-plugin : 16.8.1
@nrwl/tao : 16.8.1
@nx/web : 16.8.1
@nx/webpack : 16.8.1
nx-cloud : 16.4.0
typescript : 5.1.6
Failure Logs
npm ERR! code 1
npm ERR! path /home/circleci/project/node_modules/nx
npm ERR! command failed
npm ERR! command sh -c -- node ./bin/post-install
npm ERR! > NX Missing Platform Dependency
npm ERR!
npm ERR! The Nx CLI could not find or load the native binary for your supported platform (linux-x64).
npm ERR! This likely means that optional dependencies were not installed correctly, or your system is missing some system dependencies.
npm ERR! For more information please see https://nx.dev/recipes/troubleshooting/troubleshoot-nx-install-issues
npm ERR! A complete log of this run can be found in:
npm ERR! /home/circleci/.npm/_logs/2023-09-22T09_31_02_663Z-debug-0.log
Package Manager Version
No response
Operating System
- [X] macOS
- [X] Linux
- [ ] Windows
- [ ] Other (Please specify)
Additional Information
-
npm ci
works locally (but on adarwin-x64
platform) - deleting and re-generating
package-lock.json
did not fix the issue (as expected since the issue related to the installation platform) - Problem occurred since migrating from NX 16.3.2 to NX 16.8.1
I just got hit by this in a very unexpected manner. The issue appeared in my case on Github actions. I thought I've had updated to 16.8.1
few days ago and it was working nice, but today it started failing with the same error you're describing. By downgrading to 16.8.0
everything got back to normal.
EDIT: Clearing the NPM cache and re-generating the package-lock also fixed the problem with @nx/*
version 16.8.1
. So either something has been fixed in your side, or it was a package-lock problem.
Same error here.
Node : 18.17.1
OS : darwin-arm64 ==> local platform works, but CI platform is linux-x64 (SAME)
npm : 9.6.7
nx : 16.9.1
@nx/js : 16.9.1
@nx/jest : 16.9.1
@nx/linter : 16.9.1
@nx/workspace : 16.9.1
@nx/cypress : 16.9.1
@nx/devkit : 16.9.1
@nx/eslint-plugin : 16.9.1
@nx/next : 16.9.1
@nx/react : 16.9.1
@nx/storybook : 16.9.1
@nrwl/tao : 16.9.1
@nx/vite : 16.9.1
@nx/web : 16.9.1
typescript : 5.1.6
we ran pnpm prune
right before the install, seemed to worked.
Node : 18.18.0 OS : linux-x64 pnpm : 8.6.10
nx : 16.9.1
From what I've seen, it's always something related to the package lock not generating properly. Check the package lock file to make sure all the optional dependencies are listed there.
If the package lock file looks ok, can you confirm that the required .node binary is installed in your CI with find ./node_modules -name "nx*.node"
If you see nx-linux-x64-gnu.node
or something similar and it still doesn't work, can you give me the exact set up used for your CI so that I can see if we need to do anything special for that distro.
I have re-generated the lock file and the issue was resolved for me this way.
I am not 100% sure what is the root issue, but it broke for me after I updated various packages of my Ubuntu distro and various homebrew packages, including n (node version manager that I use) and started using node v20.9.0. So a lot of changes and I guess some combination of it made it stop working. Anyway, regenerating the lock file fixed it.
Installed nx version (16.10.0) did not change before and after lockfile re-generation, so it's not resolved by changing nx version.
Are you running nx project targets directly with the nx
command?
Is the Nx CLI installed globally?
For example, doing something like this within your Nx workspace:
nx serve my-project
When you run a nx
project target like this, it uses the globally installed Nx CLI. The above command would fail if the Nx CLI wasn't installed globally anyway.
If for some reason the native platform binaries weren't globally installed alongside the Nx CLI, the error presented in this issue is thrown.
Yes?
1. Make sure you have the native platform binaries installed globally or install them with:
npm install -g @nx/nx-linux-x64-gnu @nx/nx-linux-x64-musl
2. Restart your IDE and run nx project project targets as usual.
nx build my-project
No?
Install the native platform binaries on the project level using your favorite package manager.
1. Install platform binaries as optional dependencies
pnpm install -O @nx/nx-linux-x64-gnu @nx/nx-linux-x64-musl
2. Invoke Nx commands with your node package manager
Example:
npm|pnpm|yarn exec nx serve my-project
OS : Linux - WSL (Debian) Node : 18.18.2 PNPM : 8.10.5
nx : 17.1.2
@Cammisuli Using NX 16.10.0
This is in my package-lock.json
Here are optionalDependencies for node_modules/nx
"optionalDependencies": {
"@nx/nx-darwin-arm64": "16.10.0",
"@nx/nx-darwin-x64": "16.10.0",
"@nx/nx-freebsd-x64": "16.10.0",
"@nx/nx-linux-arm-gnueabihf": "16.10.0",
"@nx/nx-linux-arm64-gnu": "16.10.0",
"@nx/nx-linux-arm64-musl": "16.10.0",
"@nx/nx-linux-x64-gnu": "16.10.0",
"@nx/nx-linux-x64-musl": "16.10.0",
"@nx/nx-win32-arm64-msvc": "16.10.0",
"@nx/nx-win32-x64-msvc": "16.10.0"
},
I do install with:
npm clean-install --omit=dev
But I still get the error mentioned. Any ideas?
Just fyi that is started working after we migrated to nx v17.2.8
following..
this started happening to me after migration to nx18 using nodejs20.11 and npm 10.4
I build my package lock on Windows therefore npm installs only nx-win32-x64-msvc
. Hence in CI that runs on linux doing npm ci
results only in installing the windows package again...
--include=optional
parameter seems to do the trick
On Stackblitz at the moment the issue is present. Please follow this link for running the web container: Stackblitz NX Example
Platform specific dependencies are installed even thought following error on any nx command is present:
NX Missing Platform Dependency
The Nx CLI could not find or load the native binary for your supported platform (linux-x64).
This likely means that optional dependencies were not installed correctly, or your system is missing some system dependencies.
For more information please see https://nx.dev/recipes/troubleshooting/troubleshoot-nx-install-issues