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

[BUG] NPM --omit=optional results in dependency version not being installed #7618

Open
2 tasks done
flanagansshenanigans opened this issue Jun 29, 2024 · 0 comments
Open
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps

Comments

@flanagansshenanigans
Copy link

flanagansshenanigans commented Jun 29, 2024

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Have installed a local package into optional, while also have an alternative path in the "dependencies" section of package.json

Running the install command with no flag:
npm install node node_modules/node-red/red.js

image

Results in the "lower-case2" function showing in node-red. Also if I remove "lower-case": "file:./lower-case2" from "optionalDependencies" and re-run the above commands the result in similar to the previous behavior except "lower-case2" becomes "lower-case"

image

Now when I run install with the flag omit for optional dependencies:
npm install --omit=optional node node_modules/node-red/red.js

The result is that neither "lower-case" or "lower-case2" shows under the functions panel.

image

Expected Behavior

I expect that when I omit optional dependencies, that the package under the same name but in the "dependencies" section of package.json to install.

Commands:
npm install --omit=optional node node_modules/node-red/red.js

Expect:
"lower-case" to show in the functions panel.

image

Steps To Reproduce

  1. Go to https://stackblitz.com/edit/stackblitz-starters-d1ax1g?file=package.json
  2. Run 'npm install'
  3. Run 'node node_modules/node-red/red.js'
  4. See error

Environment

  • npm: 10.2.3 + 10.7.0
  • Node.js: 18.20.3 + 20.15.0
  • OS Name: Windows 11
@flanagansshenanigans flanagansshenanigans added Bug thing that needs fixing Needs Triage needs review for next steps labels Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps
1 participant