-
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 does not work #6880
Comments
duplicate of #1297 as "re-reported" by @cobyism, @fugufish, @JimmyCDChen and other.
|
the symbolic link is created in |
probably related: #6801 |
This issue also started happening for me. On yarn version |
For me, it looks like the path that is set for the symbolic link is the absolute path prefixed with '../''s. Once this is fixed, yarn link works. |
Jan 18 2020 - still happening.
What a bother. |
The same problem, can not resolve the module even if the link is created. |
I had the same problem. Only that, it was working few days ago. Later, when I changed the directory of my project, it stopped working. I tried linking again and it showed linked successfuly. Still, it throws a module not found error. |
Same problem using lerna. |
For a temporary solution, you can direct link by providing direct paths wherever you import that particular module and then rebuild the whole project.
|
A temporary solution I thought was to use file:path in package.json ... could be a better solution and avoid the various paths in the imports |
It seems I found why it is not working as expect. My |
yes, my .config is a symlink ! |
I have a similar problem with yarn link, I'm linking my own library This is the error message: The file The compiled code by babel that triggers the above error is this line: var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); when I add the file extension, the error disappears: var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault.js"); I have the same problem if link it with npm and I haven't found the way to configure babel so that it includes the file extension. "dependencies": {
"framework": "link:../framework"
} |
I also encountered this issue with 1.22.10 where my |
Just figured out link is applied on The only solution for me is to |
@existe-deja this is exactly what I needed. Thank you! |
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" |
im getting $ yarn link $ yarn link [-A,--all] [-p,--private] [-r,--relative] any help |
This very much didn't work for me. The
|
Is anyone still struggling with this? I have a very simple setup with two local packages one linked and the other should install the first one from local but I keep getting 404 errors, I tried removing and adding again but that did nothing |
Just been bitten by this as well, and this issue helped tremendously so thank you 🙇🏽 Using yarn 1.22.19 and my |
Hi, not sure if you still need help. But if you don't this may also help other people. I've been struggling to link my local project all day and finally come to the conclusion that yarn link is aimless for Yarn 3+ at least. This stack overflow answer helped, you need to use the portal protocol to obtain the package which is the symlink. Okay, cool, but how do we use it? The only solution that worked for me is to:
I've tested this over and over again, and doing a yarn link on the package simply doesn't work. You need to add the symlink via a portal using the above If you somehow figure out that yarn link does indeed work for you (and you're using Yarn 3+) you cannot set a link on the current package but rather in the place you require it, you need to link it from there. https://yarnpkg.com/cli/link Edit: For further help to those still a little confused. Ensure the package you want to import has been built. If you're using a front-end tool like Vite, you can use the command Hope this helps all :) |
I am hitting this with When looking in my my .config folder is not a symlink. Manually creating the symlink is tedious, but it does accomplish the task so I'll take it. |
Where's the |
Your home directory:
|
It seems for yarn 4 the way link works has changed from older versions. I was confused, but I tried the method from the yarn 4 docs and it seems to work. Yarn classic
Yarn 4
|
@p-sebastian Running Is there a way to link to global packages without having to insert your home directory into the package.json resolutions? We're trying to globally link to some pretty large libraries like Font Awesome, so we can package them into custom fonts per site. This used to be possible with npm global installs, but newer versions of yarn seem to be deprecating all this. |
yarn 4+ projectA is using yarn 4+ but projectB is using yarn classic EDIT: upgrading yarn in projectB ( |
After attempting some of the suggestions here but still struggling to get it to work, I somehow managed it:
The above made it work for me. In addition, every time I build a new version of Sharing this just in case, as it seems a lot of people struggled with the other suggestions too. |
I used linking routinely for yarn versions 1 and 4, I know how it works. Suddenly it stopped working for version 1. Tried everything above but nothing worked. It's disappointing to see this bug open for more than 6 years. |
This is a bug report
Current behavior, and step to produce:
To illustrate the problem (bug) I have created a sample repo, which you can find at:
https://github.com/ApolloTang/issue-yarn-link-does-not-work
It has two folders: one has content which is the dependency package, the other a project that using the dependency package:
in dependency/ folder:
screenshot:
This created a link in my
~/.config/yarn/link
.To confirm this :
screenshot:
My
~/.config/yarn
has the following structure:screenshot:
From the above the link is indeed pointing to my dependency folder. To confirm:
screenshot:
Now that the link has created I can cd to the project folder to link the dependency; However, I got
screenshot:
I also notice that if I go back to the dependency package folder, yarn can not unlink the package:
screenshot:
It seem like
yarn link
does not know where the directory~/.config/yarn/link
is.Here is the output of my
yarn config list
:Here is the content of my
.yarnrc
:Here is my environment:
screenshot:
The text was updated successfully, but these errors were encountered: