You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
saziri-arrow
changed the title
[BUG] DevDependancy are install in production when also marked as optional peer
[BUG] DevDependancy are installed in production when also marked as peerDependenciesMeta optional
Aug 19, 2024
@saziri-arrow I could see that, There might a typo in the command you are running npm install --omit-dev, can you try changing it npm install --omit=dev ?
for me the behaviour seems correct.
for this package.json which resembles your test case
As you can see from the log the lodash is missing after running npm install --omit=dev
~/workarea/rep $ npm install --omit=dev
up to date, audited 1 package in 3s
found 0 vulnerabilities
~/workarea/rep $ npm ls
rep@1.0.3 /Users/milaninfy/workarea/rep
└── UNMET DEPENDENCY lodash@4.17.21
npm error code ELSPROBLEMS
npm error missing: lodash@4.17.21, required by rep@1.0.3
npm error A complete log of this run can be found in: /Users/milaninfy/.npm/_logs/2024-08-19T14_16_19_901Z-debug-0.log
Hello @milaninfy thank you for your fast answer! Indeed I made a mistake in my first explanation... I edit it and now the problem appears with --omit=dev still. Please test again
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
Hello,
I have an unexpected behaviour between peerDependencies, peerDependenciesMeta and devDependencies.
I have a library with a package.json with a peerDependancy (example with typeorm) :
"dependencies": {
"typeorm": "^0.3.2"
}
typeorm has ts-node as a peerDependacy optional : https://github.com/typeorm/typeorm/blob/master/package.json#L216
When I run npm install --omit=dev, ts-node and typescript are not installed (correct behavior)
Now I also add ts-node as a devDependancy since I want to use it in my unit tests :
"devDependencies": {
"ts-node": "^10.9.2"
},
Now, when I run npm install --omit=dev, typescript package is installed (wrong behavior)
Tried with npm 9.8.1, and 10.8.1
Issue happen with any library.
Any projet who has 'ts-node' as a devDependancy and use typeorm will have typescript installed in production
Can you fix this issue ?
Expected Behavior
ts-node should not be installed with npm install --omit=dev
Steps To Reproduce
run npm install --omit=dev with the example ahead
Environment
The text was updated successfully, but these errors were encountered: