Open daniorca opened 4 days ago
Same here installing deps in CI environment. We're using ubuntu-latest image and node 18.20
Run npm ci --legacy-peer-deps
npm ci --legacy-peer-deps
shell: /usr/bin/bash -e {0}
npm warn deprecated @storybook/expect@[2](...)8.1.3-5: In Storybook 8, this package functionality has been integrated to a new package called @storybook/test, which uses Vitest APIs for an improved experience. When upgrading to Storybook 8 with 'npx storybook@latest upgrade', you will get prompted and will get an automigration for the new package. Please migrate when you can.
npm error code 1
npm error path /home/runner/work/prj/node_modules/nx
npm error command failed
npm error command sh -c node ./bin/post-install
npm error /home/runner/work/prj/node_modules/nx/src/native/index.js:2[4](...)4
npm error throw loadError
npm error ^
npm error
npm error Error: Cannot find module '@nx/nx-linux-x64-gnu'
EDIT: adding '@nx/nx-linux-x64-gnu' as optional dependency, updating lockfile and my workflows commands solved the install issue
I can also confirm that running the following after successfully build my image got this output
docker run -it core-service /bin/sh
/usr/src/app # find ./node_modules -name "nx*.node"
./node_modules/@nx/nx-linux-x64-gnu/nx.linux-x64-gnu.node
./node_modules/@nx/nx-linux-x64-musl/nx.linux-x64-musl.node
and despite of that when running my containers I got the error
NX Missing Platform Dependency The Nx CLI could not find or load the native binary for your supported platform (linux-x64).
Hey! This might be because of the native file cache. Can you try setting NX_NATIVE_FILE_CACHE_DIRECTORY
to a folder that is accessible from your docker container via an env var? Probably it's some permission issues.
I will work on better surfacing the actual error message.
@MaxKless
"Hey! This might be because of the native file cache. Can you try setting NX_NATIVE_FILE_CACHE_DIRECTORY
to a folder that is accessible from your docker container via an env var? Probably it's some permission issues. I will work on better surfacing the actual error message."
I have changed my dockerfile this way to include your suggestion
###########################
FROM node:18-alpine As development
WORKDIR /usr/src/app
COPY package.json ./ COPY package-lock.json ./ COPY tsconfig.base.json ./ COPY apps/backend/core-service apps/backend/core-service COPY libs libs
RUN npm install --include=optional
RUN mkdir -p /tmp/nx-native-file-cache ENV NX_NATIVE_FILE_CACHE_DIRECTORY=/tmp/nx-native-file-cache
RUN npm exec nx run backend-core-service:build
#####################
the docker image file was created successfully and I ran this command to verify that native files are there
find ./node_modules -name "nx*.node" ./node_modules/@nx/nx-linux-x64-gnu/nx.linux-x64-gnu.node ./node_modules/@nx/nx-linux-x64-musl/nx.linux-x64-musl.node
when running the container I got the error.
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/troubleshooting/troubleshoot-nx-install-issues
EDIT: Also to verify the access to the tmp folder I ran this
/usr/src/app # echo "Test access" > /tmp/nx-native-file-cache/test.txt /usr/src/app # cat /tmp/nx-native-file-cache/test.txt Test access
Did you also verify that the file is copied to /tmp/nx-native-file-cache
?
Current Behavior
I just migrated using nx migrate from 16.1.0 to 19.4.0
I am running my application in a docker environment.
Now I get the following error when I try to run it : The Nx CLI could not find or load the native binary for your supported platform (linux-x64).
I have tried all possible things including the one mentioned in NX documentation https://nx.dev/troubleshooting/troubleshoot-nx-install-issues without luck> I also verified that in my docker images the @nx/nx-linux-x64-musl and @nx/nx-linux-x64-gnu are present inside the packages, so I am not sure why the NX cli can't find it.
Expected Behavior
The application should run as before with the current platform declared in my dockerfile.
GitHub Repo
No response
Steps to Reproduce
1.
Nx Report
Failure Logs
Package Manager Version
npm : 10.8.1
Operating System
Additional Information
this is one of my dockerfiles
FROM node:18-alpine As development
WORKDIR /usr/src/app
COPY package.json ./ COPY package-lock.json ./ COPY tsconfig.base.json tsconfig.base.json COPY apps/backend/core-service apps/backend/core-service COPY libs libs
RUN npm install --include=optional RUN npm exec nx run backend-core-service:build
============================ I have added this to my package.json file
"optionalDependencies": { "@nx/nx-linux-x64-gnu": "19.4.0", "@nx/nx-linux-x64-musl": "19.4.0" }
============================= also this is part of my docker-compose file that runs one of the services
core-service: container_name: backend-core-service build: context: . dockerfile: ./apps/backend/core-service/Dockerfile.x86 target: development command: npx nx serve backend-core-service env_file: