-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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?]: yarn dlx -p not working with package.json scripts #6500
Comments
To quote
By using
When you are in a project, simply |
@clemyan Hi, it's a common practice to create multi-stage Dockerfiles, where in one stage, we download all dependencies, and in the next, remove those not needed for production. e.g If you simply use My usage isnt replacement for yarn add, but more of a substitute for the old yarn add --global functionality. For example, in Yarn 1, it was common to install packages like Nest.js and the TypeScript CLI solely for the build process. Not doing so with the new Yarn setup can result in unnecessarily large images .
|
We have
Again, for this kind of packages, installing globally is problematic because of non-reproducible builds ("works on my machine"). Ever since If a package is used in a project by multiple developers or across multiple environments (including across host/container), then it almost certainly belongs in |
@clemyan Term "devDependencies" has a clear meaning , these are "developement" dependencies , and clearly it's not called "buildDependencies" . |
Sounds like you want a new kind of "buildDependencies" between production and dev?
Using less packages means more security, but just because it is not in your
The final image only contains production dependencies either way, so that's moot.
Yes, we are comparing a lot of thing/usecases/options here. Let's establish some baselines here:
Here are where each option stands across various metrics:
And, for a nice summary:
Given that
I don't think any of those three would fit in Yarn's core offering. That said, there are a few options you can consider: Just use
|
Hi! 👋 It seems like this issue as been marked as probably resolved, or missing important information blocking its progression. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it. |
@clemyan Hi there , sry for late response I was in hospital
I think you need to add another very important column which is "developer experience" or "ease of use" . surely we can write all sort of plugins to handle this but then instead of developing the core project one need to constantly develop this new stuffs and every new member of team need to understand these hacks that no one else knows
This is not valid comparision in case of Docker image , one install a package in a single stage of docker file and use it on that same stage, there won't be any compatibility issue here , Sure on a dev machine with tens of project it can happen but in case of a proper CI/CD pipeline it shouldnt cause any problem .
Yes if you compare them like that it's true but my main point about security was that there is absolutely no point to install dev depencies in production or build stage of Docker , there might be all sort of package in dev dependencie each depends on thousands of other packages , yes
Well all sort of problems starts here "assuming proper caching" , If we assume it then yes but out of the box it's not that obvious how one should do "proper caching" , I think there is lack of documentation about best practices e.g in my case I want to make an efficient Docker image not sure how exactly should I do it , this is not the case with old
Yes reproducibility comparision for dev and build is correct but for the other two it's not , one will e.g install typescript v5.0.2 , it's reproducible and will work , nothing will be changed in typescript v5.0.2 in different machines so both Global and Temporary will be also reproducible ( if one install global package with exact same version ) |
Hi! 👋 It seems like this issue as been marked as probably resolved, or missing important information blocking its progression. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it. |
Self-service
Describe the bug
If I use
yarn dlx -p [email protected] build
with this package.json scripts sectionI get this error :
What I'm trying to do is to find a replacement for
yarn global add
from yarn v1 without installing all dev dependencies in order to build a projectTo reproduce
clone this repository https://github.com/uchar/yarnbugs/tree/yarn_dlx_error , move to branch
yarn_dlx_error
Then run
if you use
RUN yarn dlx -p [email protected] tsc
instead ofRUN yarn dlx -p [email protected] build
it starts working.Environment
Additional context
No response
The text was updated successfully, but these errors were encountered: