Skip to content
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

Support local file dependencies without file protocol #605

Closed
ChristopherBiscardi opened this issue Oct 11, 2016 · 13 comments · Fixed by #2723
Closed

Support local file dependencies without file protocol #605

ChristopherBiscardi opened this issue Oct 11, 2016 · 13 comments · Fixed by #2723

Comments

@ChristopherBiscardi
Copy link

Do you want to request a feature or report a bug?
bug

What is the current behavior?
In a number of my projects I have a package.json with dependencies as such:

dependencies: {
    "babel-preset-something": "../ui-babel-preset-something",
}

yarn fails:

> yarn
yarn install v0.15.0
info No lockfile found.
[1/4] 🔍  Resolving packages...
error Couldn't find package "babel-preset-something" on the "npm" registry.
info Visit http://yarnpkg.com/en/docs/cli/install for documentation about this command.

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

> cd yarn-test
> ls
> mkdir a b
> cd a
> ~/.yarn/bin/yarn.js init
yarn init v0.15.0
question name (a):
question version (1.0.0):
question description:
question entry point (index.js):
question git repository:
question author:
question license (MIT):
success Saved package.json
✨  Done in 1.97s.
> cd ../b
> ~/.yarn/bin/yarn.js init
yarn init v0.15.0
question name (b):
question version (1.0.0):
question description:
question entry point (index.js):
question git repository:
question author:
question license (MIT):
success Saved package.json
✨  Done in 1.88s.
> ~/.yarn/bin/yarn.js add ../a
yarn add v0.15.0
info No lockfile found.
[1/4] 🔍  Resolving packages...
error Couldn't find package "../a" on the "npm" registry.
info Visit http://yarnpkg.com/en/docs/cli/add for documentation about this command.

What is the expected behavior?

Expected behavior is that running yarn installs the package into node_modules.

Please mention your node.js, yarn and operating system version.

  • node v6.2.0
  • yarn 0.15.0
  • OSX 10.11.3
@zertosh
Copy link
Member

zertosh commented Oct 11, 2016

Try setting the protocol as file://

@sebmck
Copy link
Contributor

sebmck commented Oct 11, 2016

Change

dependencies: {
    "babel-preset-something": "../ui-babel-preset-something",
}

to:

dependencies: {
    "babel-preset-something": "file:../ui-babel-preset-something",
}

And this should work. Wasn't aware that npm had these semantics for bare paths.

@montogeek
Copy link

It is possible to keep it compatible with npm?

@sebmck
Copy link
Contributor

sebmck commented Oct 11, 2016

@montogeek Compatibility is absolutely a priority. I'll mark this issue as a bug so we can get this fixed for the next release.

@sebmck sebmck changed the title Support Local Filesystem Dependencies Support local file dependencies without file protocol Oct 11, 2016
@ChristopherBiscardi
Copy link
Author

Adding the prefix file: to relative paths works. Thanks for the heads up.

@itsnotvalid
Copy link

bump. v0.19 series is released but there is no words from the team. cc @kittens

@mikemaccana
Copy link
Contributor

yarn 1.0.1 still attempting to pull packages from remote even if they exist in the filesystem.

@BYK
Copy link
Member

BYK commented Sep 13, 2017

@mikemaccana can you open a new issue and detail what exactly is broken with reproduction steps?

@mikemaccana
Copy link
Contributor

@BYK Sorry I can't right now. The broken node Docker images (even when I trash /opt/node and /usr/local/bin node) won't properly upgrade to yarn 1.0.1 - it installs but global bin is broken. I've had to revert to 0.27.1 after wasting far too much time trying to fix it. Sorry.

@BYK
Copy link
Member

BYK commented Sep 13, 2017

@mikemaccana just tagged 1.0.2 so may be it will help?

@chadfurman
Copy link

chadfurman commented Oct 12, 2017

Yarn doesn't seem to pull in dependencies of file:... packages nevermind, my file: package didn't have the dep I expected!

@redbar0n
Copy link

redbar0n commented Mar 14, 2018

Removing file: prefix solved a problem we had where yarn install on windows would add ./ prefix to relative file paths, but yarn install on macOS would remove it. We were both using yarn version 1.3.2.

"Since v0.21.0 release, file: prefix is not needed. See pull-request with fix and changelog." - Piotr Lewandowski on stackoverflow

@harryi3t
Copy link

harryi3t commented Mar 7, 2019

I am having this issue on 1.13.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment