yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.44k stars 2.73k forks source link

yarn link breaks with scoped packages. #5083

Open richburdon opened 6 years ago

richburdon commented 6 years ago

This is a bug.

What is the current behavior?

> cd package1/
> yarn link
info You can now run `yarn link "@company/package1"` in the projects where you want to use this module and it will be used instead.

> cd package2/
> yarn link "@company/package1"
> yarn add "@company/package1"
error An unexpected error occurred: "https://registry.yarnpkg.com/@company%2fpackage1: Not found".

The same error occurs if the named package is already in package.json before calling yarn install.

NOTE: yarn link seems to create the appropriate symlink. I.e.,

./node_modules/@company/package1 -> ../../../package1

I've also confirmed that yarn install works if I'm just using the published package (i.e., not using link).

If the current behavior is a bug, please provide the steps to reproduce. ABOVE.

What is the expected behavior? The linked package should be used.

Please mention your node.js, yarn and operating system version. node v9.2.1 yarn 1.3.2 OS/X 10.13.1

torifat commented 6 years ago

Why are you doing yarn add "@company/package1"?

richburdon commented 6 years ago

That's my scoped package. I.e., I have an npm organization @company (I mean it's not called that, but for example) and a private package called package1.

filipposarzana commented 6 years ago

We are having the same issue :cry: Any news on this?

Coridyn commented 6 years ago

We use npm's private organisation scope and have had issues getting them installed with Yarn.

My workaround was to explicitly set my Yarn registry to https://registry.npmjs.org/ (i.e. our organisation private registry happens to be the npm registry) and I am now able to link and install my private scoped organisation modules.

$ yarn config set registry https://registry.npmjs.org/

This is with Yarn 1.3.2 on Windows 10

timrs2998 commented 6 years ago

I can confirm this issue with Yarn 1.3.2 on macOS Sierra 10.12.6

tanguyantoine commented 6 years ago

Same issue

efortes commented 6 years ago

I have the same issue. @Coridyn your registry change worked: $ yarn config set registry https://registry.npmjs.org/

jherdman commented 6 years ago

The registry hack doesn't seem to be working for me on yarn 1.10.

kristian commented 6 years ago

Any update here? Also does not work with v1.12.0!

maximelafarie commented 5 years ago

Same error with version 1.12.3. What's the status of this issue given that some other people also faced it? 🤔

MikeMitterer commented 5 years ago

Recently I switch from Dart to TS and I'm always surprised how such thing like working with local modules/packages can still be a problem in the JS world. 1.12.3

armordog commented 5 years ago

My coworker has this problem on MacOS (Sierra 10.12.6) with yarn 1.13.0.

yarn link with scoped packages works fine for me on Windows 10 (yarn 1.10.1).

RobMayer commented 5 years ago

still a thing with yarn 1.19.1 on Win 7, I'm afraid.

EthanJStark commented 5 years ago

Also have this issue on MacOS 10.14.6

simpleshadow commented 4 years ago

Workaround for me was to escape the forward-slash and manually add to package.json dependencies:

yarn link @company\/package-name
redmundas commented 4 years ago

I have the same issue on linux machine and the solution provided by @simpleshadow works for me :+1:

naavis commented 3 years ago

I am still having the same error as in the starting post of this thread, on Windows 10. Linking the package by escaping the forward slash does not help either. Manually adding the package to dependencies in package.json and running yarn install results in the same error.

Not sure if it makes a difference, but I am trying to test a package that has not been published to any registry yet, so it only exists on my hard drive. Why does it still try to search for it on registry.yarnpkg.com after linking?

naavis commented 3 years ago

Turns out there's a separate ticket for this: https://github.com/yarnpkg/yarn/issues/2611