Skip to content
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

Aliased dependencies with version ranges are pruned from generated lock files #21009

Closed
1 of 4 tasks
zbristow opened this issue Jan 4, 2024 · 1 comment · Fixed by #23474
Closed
1 of 4 tasks

Aliased dependencies with version ranges are pruned from generated lock files #21009

zbristow opened this issue Jan 4, 2024 · 1 comment · Fixed by #23474
Assignees
Labels

Comments

@zbristow
Copy link
Contributor

zbristow commented Jan 4, 2024

Current Behavior

I'm building a project using the @nx/jw:tsc executor with the generateLockfile option enabled because I would like to eventually use the pruned lockfile to build a Docker image.

Our project depends on @opentelemetry/auto-instrumentations-node which has a transitive dependency on an aliased package using a version range. This aliased package (@types/ioredis4) gets pruned from the generated lock file which causes npm ci to fail when installing packages to build our Docker image.

Expected Behavior

The aliased package does get not pruned from the generated lock file.

GitHub Repo

https://github.com/zbristow/nx-aliased-package-bug

Steps to Reproduce

  1. Check out https://github.com/zbristow/nx-aliased-package-bug
  2. Install packages npm i.
  3. Build the project npx nx run example:build.
  4. Build the Docker image docker build -f apps/example/Dockerfile dist/apps/example to trigger the failure.

Nx Report

Node   : 18.18.0
   OS     : darwin-x64
   npm    : 9.8.1

   nx (global)        : 17.1.3
   nx                 : 17.2.8
   @nx/js             : 17.2.8
   @nx/jest           : 17.2.8
   @nx/linter         : 17.2.8
   @nx/eslint         : 17.2.8
   @nx/workspace      : 17.2.8
   @nx/devkit         : 17.2.8
   @nx/esbuild        : 17.2.8
   @nx/eslint-plugin  : 17.2.8
   @nx/nest           : 17.2.8
   @nx/node           : 17.2.8
   @nrwl/tao          : 17.2.8
   @nx/webpack        : 17.2.8
   typescript         : 5.2.2

Failure Logs

1.804 npm notice
1.804 npm notice New major version of npm available! 9.8.1 -> 10.2.5
1.804 npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.2.5>
1.805 npm notice Run `npm install -g [email protected]` to update!
1.805 npm notice
1.807 npm ERR! code EUSAGE
1.811 npm ERR!
1.811 npm ERR! `npm ci` can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. Please update your lock file with `npm install` before continuing.
1.811 npm ERR!
1.811 npm ERR! Missing: @types/[email protected] from lock file
1.811 npm ERR!
1.812 npm ERR! Clean install a project
1.812 npm ERR!
1.812 npm ERR! Usage:
1.812 npm ERR! npm ci
1.812 npm ERR!
1.812 npm ERR! Options:
1.812 npm ERR! [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
1.812 npm ERR! [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
1.812 npm ERR! [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit]
1.812 npm ERR! [--no-bin-links] [--no-fund] [--dry-run]
1.812 npm ERR! [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
1.813 npm ERR! [-ws|--workspaces] [--include-workspace-root] [--install-links]
1.813 npm ERR!
1.813 npm ERR! aliases: clean-install, ic, install-clean, isntall-clean
1.813 npm ERR!
1.813 npm ERR! Run "npm help ci" for more info
1.815
1.815 npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-01-04T17_59_04_770Z-debug-0.log

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@AgentEnder AgentEnder added the scope: core core nx functionality label Jan 9, 2024
FrozenPandaz pushed a commit that referenced this issue May 21, 2024
<!-- 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` -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #22098
Fixes #21180
Fixes #21009

---------

Co-authored-by: James Henry <[email protected]>
(cherry picked from commit 0eb86c8)
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants