-
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
Yarn link doesn't work #1297
Comments
Probably, there is a bug when linked package name include the hyphen. The same problem may be in #1161. |
Same problem with package with no hyphen in name; it still looks for package in on the "npm" registry. Dead in the water without this working on my current project. |
Any news on this? I think I'm having the same issue (at least the result is the same). If it helps, some details regarding my situation:
I have no idea why the link works for the dependencies themselves but not for the main application. |
Hmmm, anybody found a workaround? Would like to use Yarn, but this is a major blocker :( |
Yarn link seems completely broken? Would be great to get an update from the devs on this. Is anybody having luck using link at all? |
Hey guys, let's try to use symbolic linking instead $> ln -nsf ../foo node_modules/foo It can be used into package.json: "scripts": {
"link": "(mkdir node_modules || true) && ln -nsf ../foo node_modules/foo && ln -nsf ../bar node_modules/bar",
"setup": "yarn run link && yarn"
}, Just run setup task: $> yarn run setup |
Run into the same issue. After linking and install the package I got:
|
We are going to revamp link: feature soon, see yarnpkg/rfcs#34 |
Ok I will wait you guys, if you need some help let me know :) |
@RusPosevkin could you confirm that if this issue has been resolved in v0.26 prerelease? |
it does not seem to to work on latest prerelease |
This comment has been minimized.
This comment has been minimized.
create a brand new package that is not registered on npm, use |
first time you need to call |
either way it doesn't work. |
This is borked for me too - only when my dependency is installed locally can I get things to work, otherwise:
|
I think we are talking about different issues here. @fugufish, do I understand it right that you |
@cloakedninjas, yarn would not run install on linked project, this is expected behavior. |
Pretty sure there’s still something messed up with this command. Here’s what I’m running into:
What am I missing? |
This is still an issue 😢 |
Is anyone working on this issue? |
@bestander What's going on with this issue? There's PR #7028 ready to go with minimal changes and a lot of people are waiting on it. You mentioned that linking will be revamped soon, but that was 2017 and it's now 2021. Can we just get the PR approved and fix this bug? |
The yarn official documentation should link to this ticket so that people know not to waste their time trying to link packages like they have with npm for years. Update: After a few recommendations to try |
This is still an issue ! Has any plan to fix it? |
It seems as if this may never be worked on....'16 to '21 c'mon! |
Creating the |
For me (with Yarn 2) the link seems to work, but unlink does not. $ yarn unlink ../../module
Usage Error: Couldn't find a script named "unlink". |
This comment has been minimized.
This comment has been minimized.
@MarsianMan The |
This comment has been minimized.
This comment has been minimized.
This is the unfortunate truth that I think most people in this thread likely landed on. This issue has been open for 5 years now and is still a major problem. The time to move on was long ago. People marking that as spam show the lack of interest in actually improving yarn. Instead of reading it as "hey, this bug is 5 years old now - maybe consider prioritizing major broken features" they decided to read it as simply "just use npm" even though that is literally the only practical solution at this point. |
Maybe just delete the yarn link from the documentation if it doesn't work! |
I was trying to use yarn link (yarn 3.0.2) to link to a local folder and was getting an error about workspaces:
This was working for another dev on my team so I suspected it was a global config problem. Those who used For me, what worked was to clear out some user config, specifically I deleted this file and this directory:
(I'm sure these were created through all the trial and error of trying to get this to work and reading various blog posts over the years of how this used to work.) |
I had to downgrade my yarn to 1.22.4 to make it work. To check yarn version: To set specific yarn version: |
rm -rf node_modules (project-a) rm -rf node_modules (project-b) yarn cache clean -f yarn (project-a) yarn link (project-b) node ./scripts/linkPackages.js --link project-b --origin (project-a) It worked for me |
For anyone struggling on your package yarn link Then on the repo you want the linked package # p is for private package
yarn link -p ~/path/to/my/package This will add this line to the "package": "portal:/absolute/path/to/my/package" |
@p-sebastian but did that install it in your project and you were able to import it and moreover use it? Update for Yarn 3:So what Let me illustrate what I mean: package.json{
"dependencies": {
"some-package": "0.1" // uses "lodash" version 0.2.0
},
"resolutions": {
"lodash": "0.2.1" // stricts the use of "lodash" to version 0.2.1
}
} Assuming I could use the previously linked private package in my main project through @p-sebastian suggestion and additionally adding my private package to the dependencies with the following command yarn add <package-name> Thus, I am not sure if I am missing something or not but from my explanation to the |
This is such a common use case that every other package manager solves. In the JVM world there has been local publishing of snapshots for several decades. You may as well give up on |
Outstanding this does not work even in v4 I'm running Usage Error: Invalid destination '@form-atoms/field'; Can't link the project to itself |
similarly |
Same here... :\ |
@justtal @atomoc @MiroslavPetrik Try this for Yarn 4 - it worked for me |
For everyone using Yarn @3.6.3 (Yarn 3) and workspaces. This worked for me: Assume the following folder structure:
This worked for me! |
Same issue.
|
@Poolshark Running Is there a way to do that without adding links to your home directory in package.json? |
@callaginn I think I do not quite understand. Why would you share the target repository with a linked local package? Since the package only exists locally, you would need to share the local package source too. I'm not certain about your use-case but usually the only reason for In any other case I would make the package part of the |
Just use |
Do you want to request a feature or report a bug?
Bug.
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce.
See above.
What is the expected behavior?
Please mention your node.js, yarn and operating system version.
The text was updated successfully, but these errors were encountered: