-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"NX Cannot find module '@nrwl/nx-linux-arm64-gnu'" when running angular universal in a node:18 docker #15452
Comments
I faced a similar issues to yours, My resolution was to do the following steps:
|
Hey @nguyenchu2306! Thank you, for your reply. Actually I'm using docker in the context of a local development environment on macOS, where there is no Jenkins, no pipeline, and I'm using npm. I temporarily solved the error by downgrading back to my earlier version. |
Hi @jwittekind, |
Thank you @nguyenchu2306! I'll stick with the downgrade for now. If this feature is not be planned to be widely supported - i'd prefer an "opt in" instead of an "opt out". |
We want to support all the environments that people use. It's not too difficult for us to build binaries for different systems. But we do build binaries for linux-arm64-gnu. What is the content of your package.json? Also, it looks like you don't do a |
related to #15380. |
Hey @Cammisuli The docker container uses a mounted volume to use the node_modules directory of the host machine. here's my Package.json of my downgraded repository ;)
|
Oh, thats the reason then. Npm/yarn will install the specific native binary for your OS and arch. So if you run npm install on your darwin based os, you will only get We can't specifically add those packages as deps because there's a hard requirement on the os and architecture of the host, and npm will fail the install if it detects a different os/arch than what is specified. So I suggest to not mount the host node_modules, and do a npm install in the container. |
@Cammisuli I'm facing with the same issue. My docker file content is the following:
With this config I get |
We are having a similar issue with '@nrwl/nx-linux-x64-gnu'. We are installing our dependencies with |
Thank you @timonmasberg! Now I can get my hands dirtier and take your run apart 🙂 |
After looking at @timonmasberg flow, it looked like the package-lock.json removed the needed packages. So for people having issues still, please take a look at your package-lock.json, pnpm lock, yarn lock, all your locks and make sure that the native packages are listed there. Specifically look for |
@Cammisuli, since |
Yes they are. The binary packages are optional dependencies on nx. For some reason it looks like the package-lock.json doesn't include them. |
So for those of us who are running |
@jaredtbates no you should not explicitly add the native packages to your package.json files. Those packages are already part of the optional dependencies for the nx package. Just make sure to run npm install without |
@nrwl/nx-linux-x64-gnu is not in my pnpm lock. Am i meant to add it explicitly? |
sorry for jumping on this as well but it's causing me issues in Cloudflare Pages and I've no idea what's going on. They use node: v16.19.1 I see these inside package-lock.json:
Error when installing:
The only way I'm able to fix it is by hooking into the build command within package.json:
|
we have the same issue right now. |
@jahller does the yarn.lock file have the native binaries listed? It should be something similar to this (with whatever version you're using):
|
@Cammisuli
|
@jahller is there a way for me to see the CI run or is it internal only? |
it's a private CI unfortunately. But just ask me, what you would like to know and I'll try to provide the information. |
I faced a similar issue just now. Problem: my Solution: Removed |
Running into this as well, and 2 things recommended in this thread fixed it:
|
blowing away package lock files can be a little dangerous as we end up getting new and potentially broken versions |
@damiangreen yes, that's correct. I should have pulled the |
I would argue rebuilding the package lock files should not be considered a dangerous procedure, and something you could do at any time. Using the appropriate version range descriptors in the package.json should make it so you only get updates that you are comfortable that are compatible and not breaking. As an example of when I'd regenerate it, since the lock file is a generated file, I never try to resolve merge conflicts in it manually. I just delete it and regenerate it, then commit it. |
I've updated the docs site to include some information on how to trouble shoot this issue. In summary, it's usually because of npm not including optional dependencies when node_modules already exist while doing an Nx update. https://nx.dev/recipes/ci/troubleshoot-nx-install-issues I'll need to add another point of running |
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context. |
Current Behavior
I just migrated using
nx migrate latest
I'm running angular universal in development mode and start it in a docker
node:18
Now I get the following error:
> NX Cannot find module '@nrwl/nx-linux-arm64-gnu'
As described in a similar issue, #8969
I tried to delete my
node_modules
and clear my cache.It seems like my application works if I run my nx command outside docker:
nx run my-app:serve-ssr
When starting my docker image, it throws the error above.
If i check my package-lock.json the package is listed under "optionalDependencies":
"@nrwl/nx-linux-arm64-gnu": "15.8.5"
Expected Behavior
After the migration it may should have installed the missing module
@nrwl/nx-linux-arm64-gnu
and run.GitHub Repo
No response
Steps to Reproduce
Docker Image:
Nx Report
Failure Logs
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: