Nx cannot find module. nx team should pay some attention to this issue.
Nx cannot find module. 9, is not working for us and throws the following error when running the Cypress end-to-end testing (or another NX command, e. Run the following commands to create a new nx workspace with a local plugin package. 0 Ive attempted to reinstall the packages multiple times to no avail. 1 my @nrwl/node version is 15. As written in the docs, a plugin should be able to be used locally. Jun 7, 2020 · Running either nx build --with-deps or nx run app:build --with-deps did not build the dependency first so that may be the second issue. Remove node_modules in entirety - rm -rf node_modules Delete package-lock file. yarn has been used, but the same result is obtained with npm. 8. May 20, 2022 · The issue could have happened due to the project not having the latest NX version packages. dev website. Using a local plugin generator fails with error “Cannot find module”, as shown below. As mentioned in the other answer, I don't think you need to specify paths in every project where you use May 20, 2022 · If anyone stumbles upon this in 2023 and beyond here's the simple solution which worked for me. 9. This is a common error that can be fixed in a few simple Current Behavior I create a workspace with an express app and add a node library, import my library from my express app, and node is not able to find the module. js runtime level when Nx tries to load its native binary. 2 and my node version is 16. - npm Current Behavior Using a local plugin generator fails with error "Cannot find module", as shown below. 2. Apr 10, 2023 · NX Cannot find module 'nx/src/utils/code-frames' inhibiting me from running the generator. Really disappointing. I had same issue when I was trying out the tutorial on the nx. g. 8 and 16. my nx version is 15. Jun 2, 2025 · The "Error: Cannot find module '@nx/nx-linux-x64-gnu'" directly points to the absence of the @nx/nx-linux-x64-gnu package within your node_modules. Mar 28, 2023 · It seems that the latest version, 15. If you find yourself in this position, you will need to update your global installation of Nx. Ensure the nx cli is installed in your local project, yarn add -D @nrwl/cli. nx team should pay some attention to this issue. Aug 30, 2018 · Referencing the NRWL NX generated library modules works fine from non-Angular (in my particular case Ionic/Angular) contexts, but caused the "Cannot find module" error from Angular apps within the monorepo. So this issue is actually two issues. 17. The current directory isn't part of an Nx workspace. If you see a message saying that your platform is not supported (or that Nx cannot find a @nx/nx-platform module for versions of Nx between 15. Once you rerun npm install, ensure you install the nx plugin package with the exact version of nx (As per package. 4), there are a few reasons why this could potentially happen: Running your install with --dev for pnpm. Expected Behavior As written in the docs, a plugin should be able to be used locally. . Expected Behavior Should be able to This commonly results in errors such as: Could not find Nx modules in this workspace. In most cases, you can update a globally installed npm package by rerunning the command you used to install it. json file. I tried it and it worked. nx report) on our Angular project. If you're getting the error 'Could not find nx modules in this workspace', don't worry, you're not alone. I read on some other thread that if you delete the node_modules folder and re-run npm install, the issue disappears. Sometimes nx can update few entries here which can cause issues when the app is started. While your TypeScript code relies on Nx being functional, the error itself occurs at the Node. svb afvhv eeoz oixg rckf yuh xotsbtdf sqk huxbrf agvi