-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Add package without saving to package.json #1743
Comments
No, this feature was left out intentionally. It's considered dangerous to install a package without being reflected in the package.json. Why do you want such a thing to exist? From the Facebook announcement
|
I use to used that feature pretty often to test things. Especially when I'm working with a library that I maintain and need to install a local version (which creates a While I agree npm's implementation to do it by default was a poor choice, I think this is something that can come in handy when used explicitly. |
Yeah I think allowing it to do with explicit flag would be nice to have, currently for this one can still use |
We explicitly don't support this as it's an imperative change to |
We have a dependency that can't be installed easily on windows (libxslt) so:
Is there a clean way to do it using yarn (or any better way to achieve this result) ? (I agree with you that packages should be reflected in the package.json though, but here I can't find any clean solution) |
@GuillaumeLeclerc What about |
It will be removed the next time another package is added ? Won't it ?
|
@GuillaumeLeclerc Unfortunately, yes. |
@GuillaumeLeclerc You might want to clean up your comment... |
Please add an argument like I can't use normal Please don't make me revert changes to package.json yarn.lock! |
For me, this is biting me because I'm trying to install a peerDep. Yarn has no way to install peer deps during |
@viveleroi this sounds totally correct. Why would you want to install the peer dependency without adding it to your |
@hpurmann Because it's duplicating my |
@hpurmann I want to public a react component, so react shoulde be a peerDep. However, I need to install react in the project to develop it. |
just add --no-save => it is so important |
Because |
I don't understand why the owners are so opinionated about this. If you don't see a usage of it doesn't mean there is none. I believe if people ask for it, it means they need it, and they are not necessarely stupid. |
I'm trying to use Yarn for a NodeJS project that's run on AWS Lambda. I'm kindda surprised why this feature isn't supported. My use case is that I need to install aws-sdk on my local dev environment, but I don't want it to be saved in |
yarn link and yarn add cannot live together. yarn add depends on package.json while yarn link just links the local packages over to another location. Suppose you're developing a package X that depends on Y, you're both the developer of X and Y so you keep X and Y locally and link Y into the directory of X. When you do yarn add in X, it wipes out the link to Y. How do you get around this? |
as @heikomat stated below, since npm5 uses auto-prune after install (see npm/npm#16853 + npm/npm#18921) this is not an option and could break your node_modules-folder completely. |
ok so now I can't live without npm then |
I was using For that reason, i was trying to replace the |
You already have Thank you. |
I like how every time someone explains their peculiar use case for installing a module but not recording it the maintainers come back in and recite their shibboleth. Must make it easy to feel confident in your obstinance if you can couch this same request from many different people as coming from those suffering from a moral failing. As a compromise, maybe we could name the switch Sad to see the one key flaw |
And in my case I wanted to use it as a workaround for #4297 issue :) |
Wait are you kidding me? This is a travesty. Please stop dictating how every developer workflow should work, ever. This is exactly why NPM didn't suit us and we moved to Yarn. This ideology that "package.json and yarn.lock should be source of truth" is nonsensical. Packages should be install-able without modifying the source code. Simple as that. Come on, maintainers. It's obvious there's a real need for this by the community. Please stop shutting down intelligent conversation with unfiltered and misplaced philosophy. |
Tested - does not work. |
My use case is the following: So after reading everything my question to the maintainers are this:
The undeniable fact is that all good software have config settings because good software will allow the user to choose what is best for his situation. And to always touch the 'package.json' file is good practice - but there exist edge cases where 'yarn' is just not up to the task because of this philosophy. I really like yarn because its simple and fast. It is really unfortunate that the maintainers are fighting a battle they are sure to loose - because the community is forced to revert back to slow reliable npm in order to make things work. |
Let’s turn down the temperature a bit. No one need feel disgusted by a
piece of software they’re allowed to use for free.
…On Wed, Jan 15, 2020 at 23:17 Hajime Yamasaki Vukelic < ***@***.***> wrote:
I feel disgusted that yarn makes me work in a certain way. I like to
decide things on my own, and I don't like it when my tools tell me how I
should work, insult to my intelligence being the least of the problems, and
not being able to get things done being by far the biggest.
To believe in perfect rules and that there would never be an occasion to
break them is naive. There's a difference between "best practices" and
"do-or-die". As Oliver Wendell Holmes Sr. puts it:
The young man knows the rules, but the old man knows the exceptions.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1743?email_source=notifications&email_token=AAGKTAZRWD3XJQEGH5N5RL3Q6ACZNA5CNFSM4CVUKFMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEJDBE4Q#issuecomment-575017586>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGKTAZSB4FNAIFLZIL547LQ6ACZNANCNFSM4CVUKFMA>
.
|
Make your own package manager, no-one's making you do anything. |
Not angry at all, just pointing out the error in your logic:
Yarn isn't making you do anything, they've made a tool (for free) and it works in a certain way. If you don't like it use something else. |
@foxbunny I appreciate you clarifying your disgust. :) Even if you believe that it’s reasonable and just to feel disgusted in this case, I don’t think that language is a polite way to talk to the people who have built this freely-available tool for you. You can give constructive feedback while still being respectful. |
@whitecolor the team has got a point. That option --save is stupid. Yarn guaranties equilibre between node_modules, package.json and the lock file and that's great. That's safer .... the npm --save is dangerous. It let me down many times Please STOP IT |
Or how about everyone just use the tool that works the way they think is better and calm down. |
My use case is I want to update sub-dependency of our app Thanks |
Sorry to see the community ignored by the authors. |
As an open source volunteer, one needs to have a coherent philosophy or the
project will degrade into a ball of mud. This means sometimes telling
people “no”. If you disagree, you’re welcome to make your own package
manager, just like yarn replaced npm.
…On Tue, Mar 3, 2020 at 03:53 Artur Kwiatkowski ***@***.***> wrote:
Sorry to see the community ignored by the authors.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1743?email_source=notifications&email_token=AAGKTA4K3STUMXFRUDMPJU3RFTVTLA5CNFSM4CVUKFMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENTGKUY#issuecomment-593913171>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGKTA7WL4R3R47HBU6EPI3RFTVTLANCNFSM4CVUKFMA>
.
|
^ my original comment - I honestly don't know why I'd ever need this, and I didn't know this thread would blow up so horribly - but it's amusing to see emails about it years on. I'm inclined to agree with the maintainers here:
In any case there's probably a better, more architecturally sound way to mitigate against the need for this feature. |
I created
Once installed you can simply run:
My use case is to test modules that declare
NOTE: I am aware that saving a package to install packages without saving them is ironic and basically defeats the purpose, but this is the best I could come up with and it fits my needs. |
This is very helpful, especially peerDeps support. Thank you. |
There are several good arguments for this feature. It's not like doing it the default, people is asking for it to be behind a clear flag that only people in need for it will use it. Currently, like some other, I need to do some testing during CI with other library versions that I don't want to save. I can't understand what is so hard to understand here. |
I have to |
Not sure if this usecase was ever discussed . Let me try to explain my situation - I have bunch of packages interdependent on one another in one repo. They all use the same external dependencies with a common package at root servicing sub projects underneath, each local package needs to be built in the order for the next to consume. I am trying to use yarn workspaces for this. To start I don’t have any local packages defined in my root package.json. After one full cycle of building all components, I end up having a fully updated root package.json with those local dependencies . Now when this updated one gets built on CI- all those local packages added are going to fail due to non availability. We have to remove those newly added entries to make it work in CI. |
This comment has been minimized.
This comment has been minimized.
Here's a use case for wanting to be able to do this: We're building a tool with a modular ecosystem for "appliances" within the tool, and the plan is for a local instance to be set up with those appliances, and have them activated dynamically via configuration. The appliances are published to npm (and could be invoked outside of our framework if someone wanted). The vanilla project does NOT depend on these packages, so saving to Lacking this feature seems to be a limiting decision for our project, though we'll continue to explore alternative approaches. |
Before I read "maintainers" reply here, I thought I was the most stubborn person ever. Almost 4 years... 🤦 |
"Stubbornness" is not the same as "having a design vision and not implementing everything anyone asks for". |
Design vision describes happy path, and escape hatches as the one requested here, add to the usefulness for the wider community. |
Why not just add a section to the lock file that keeps track of "freeform" installs, and incremental snapshots of the status quo (in Git solved this problem decades before you, catch up! Just come up with something! That is what design is - circumventing limitations, rather than fighting them (or yielding to them). The tunnel vision in both ends here is born of ignorance, overthinking, and needless polarization. There's no martial arts or philosophy or revolution or politics; there's just a tool, a bunch of code, and a job to be done. If the tool can't help get the job done, it is not a tool for that particular scenario. And for a tool purporting to be a general-purpose full on replacement, like Yarn is, there are so many common scenarios being neglected here that it's simply digging its own grave. I feel like everybody's pushing against each other up a narrow hill when we could just go around it. |
The below entries in my It means the
Performing local tests is the only circumstances a package is (temporarily) needed. In all other cases it should be provided by the (singleton) version of react within the user's own repo. Basically the See https://reactjs.org/warnings/invalid-hook-call-warning.html#duplicate-react for the runtime error which react apps hit when react is either a dependency or devDependency of any imported library. That webpage hopefully explains how the opinonated feature-omissions from |
Actually after a bit more experimentation, while this leaves the package.json in a good state to be committed, it still messes with the local node_modules in a way which interferes with bundling, causing the tested package to have its own copy of react after running tests and therefore bundling it incorrectly and creating the React error linked above. That's because as far as I can see there's no way to use the yarn cli to add back a peer dependency without actually installing it. So finally my package.json has these as a workaround instead...
|
It seem there is no possibility to install package using yarn without touching package.json? (like npm install without --save params). Shouldn't such feature be added?
The text was updated successfully, but these errors were encountered: