-
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
Running nx
not at the repository root uses the wrong package manager (npm
instead of pnpm
)
#19831
Comments
@nx/js:library
generator uses wrong package manager to install new dependencies.nx
not at the repository root uses the wrong package manager (npm
instead of pnpm
)
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. |
Not stale, tested again today with the following this time, from the
.repo-root/libs/ > nx report
NX Report complete - copy this into the issue template
Node : 20.10.0
OS : win32-x64
npm : 10.5.0
nx (global) : 18.0.8
nx : 18.0.8
@nx/js : 18.0.8
@nx/eslint : 18.0.8
@nx/workspace : 18.0.8
@nx/cypress : 18.0.8
@nx/devkit : 18.0.8
@nx/eslint-plugin : 18.0.8
@nx/plugin : 18.0.8
@nx/react : 18.0.8
@nrwl/tao : 18.0.8
@nx/vite : 18.0.8
typescript : 5.4.2 .repo-root/ > nx report
NX Report complete - copy this into the issue template
Node : 20.10.0
OS : win32-x64
pnpm : 8.15.4
nx (global) : 18.0.8
nx : 18.0.8
@nx/js : 18.0.8
@nx/eslint : 18.0.8
@nx/workspace : 18.0.8
@nx/cypress : 18.0.8
@nx/devkit : 18.0.8
@nx/eslint-plugin : 18.0.8
@nx/plugin : 18.0.8
@nx/react : 18.0.8
@nrwl/tao : 18.0.8
@nx/vite : 18.0.8
typescript : 5.4.2 |
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> The package manager is detected based off of the relative `cwd` which in most cases is `''`. This incorrectly goes off of the `cwd` of the command rather than the location of the `package.json` file being modified. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> The package manager is detected based off the absolute path of the directory containing the `package.json` file being modified. So if this is the root, it will detect the package manager at the root rather than the `cwd` ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #19831 (cherry picked from commit 155e69b)
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
Using the NX Generator UI from NX Console in WebStorm, I generated a new JS library (
[...]/.bin/nx.cmd g @nx/js:library --name=new-name --bundler=esbuild --directory=new-name --minimal=true --projectNameAndRootFormat=as-provided --no-interactive
) from myapps
directory.esbuild
was not part of my dependencies, so it added it to mypackage.json
file (with the@nx/esbuild
).The generator then tried to install the dependencies using
npm install
even though I am usingpnpm
. Obviously,npm install
failed (> NX Command failed: npm install
).It seems that even
nx report
shows this behavior where is not run from the root, it will not use the right package manager.Expected Behavior
The generator uses
pnpm install
in apnpm
repository, no matter which directorynx
is run from.GitHub Repo
No response
Steps to Reproduce
pnpm
repository, create a workspace.package.json
and the associated lockfile is.Nx Report
Failure Logs
No response
Package Manager Version
No response
Operating System
Additional Information
No response
The text was updated successfully, but these errors were encountered: