-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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] --production installs devDependencies if the devDependency has a shrinkwrap #1113
Comments
I am facing the same problem with
|
I'm seeing similar behavior though I don't think it's been tracked down to a shrinkwrap file. Eg, just installing $ rm -rf *.json node_modules && \
npm init -y && \
npm install -D mocha --no-audit && \
rm -rf node_modules && \
npm install --production --no-audit && \
ls node_modules | wc -l
14 I can see that package-lock.json does indeed omit However, if I manually specify one of mocha's dependencies, $ rm -rf *.json node_modules && \
npm init -y && \
npm install -D mocha es-abstract --no-audit && \
npm rm es-abstract --no-audit && \
rm -rf node_modules && \
npm install --production --no-audit && \
ls node_modules | wc -l
ls: node_modules: No such file or directory
0 |
ref: mochajs/mocha#4474 there's an example repo; in the $ npm i --production
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
added 16 packages from 12 contributors and audited 135 packages in 1.128s
12 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
$ ls node_modules
define-properties has is-regex string.prototype.trimend
es-abstract has-symbols is-symbol string.prototype.trimstart
es-to-primitive is-callable object-inspect
function-bind is-date-object object-keys This is weird indeed. I note that the Running Also note that blasting |
@ruyadorno have you seen this before? |
I believe all of those are deps of |
|
Thanks for the heads up @boneskull and no 😅 never seen that before! I just gave it a try locally to the example repo you linked above and I can also confirm it does not work as expect in npm6 (indeed it installs devDeps when using I don't believe we are going to patch npm6 moving forward other than providing security releases and small fixes from the community contributions that happens to have a very active champion. With that in mind and given that [email protected] fixes both the mocha issue described and the original issue posted by @marcosloic (also tested the
Thanks @marcosloic for the original report and @mhart and @boneskull for the help debugging it, let me know if there's anything else I can help with 😄 |
npm If your bug is preproducible on If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo Closing: This is an automated message. |
What / Why
If a project has a devDependency that itself has a shrinkwrap, then the devDependency's dependencies will be installed
When
How
npm install --only=prod
Current Behavior
devDependencies get installed
Steps to Reproduce
Expected Behavior
polymer-cli is a devDependency, as such nothing should be installed
This issue has been spotted because polymer-cli has vulnerable dependencies spotted by retirejs. The --production (or --only=prod) seems to work if the devDependency does not have a shrinkwrap file.
npm ci --production
works as expected and bypasses the devDependencies entirelyThe text was updated successfully, but these errors were encountered: