Do you want to request a _feature_ or report a _bug_?
Report a bug
What is the current behavior?
Removes everything from bower_components
directory
If the current behavior is a bug, please provide the steps to reproduce.
In a project, that uses both npm and bower, run yarn
What is the expected behavior?
Install missed modules to node_modules
and do nothing with bower_components
Please mention your node.js, yarn and operating system version.
macOS 10.12, node 6.6.0, npm 3.10.3, yarn 0.15.1
Yarn is actually a drop in replacement for bother Bower and npm. Are we correctly populating bower_components
? Can you check node_modules
to see if we're accidentally putting them in there instead?
Can you check node_modules to see if we're accidentally putting them in there instead?
Couldn't find them in node_modules
.
git status
after executing yarn
(it removes event .gitignore):
deleted: bower_components/.gitignore
deleted: bower_components/jquery-ujs/.bower.json
deleted: bower_components/jquery-ujs/CHANGELOG.md
deleted: bower_components/jquery-ujs/MIT-LICENSE.txt
deleted: bower_components/jquery-ujs/README.md
deleted: bower_components/jquery-ujs/bower.json
deleted: bower_components/jquery-ujs/src/rails.js
deleted: bower_components/jquery.payment/.bower.json
deleted: bower_components/jquery.payment/.gitignore
deleted: bower_components/jquery.payment/.travis.yml
deleted: bower_components/jquery.payment/Cakefile
deleted: bower_components/jquery.payment/LICENSE
deleted: bower_components/jquery.payment/README.md
deleted: bower_components/jquery.payment/bower.json
deleted: bower_components/jquery.payment/example/index.html
deleted: bower_components/jquery.payment/lib/jquery.payment.js
deleted: bower_components/jquery.payment/package.json
deleted: bower_components/jquery.payment/payment.jquery.json
deleted: bower_components/jquery.payment/src/jquery.payment.coffee
deleted: bower_components/jquery.payment/test/index.coffee
@skuridin do they appear in the listing when you run yarn ls
?
I'm running into the same issue. Once I run yarn
and it installs or changes dependencies then bower_components
is completely empty.
Looks like they are in node_modules
instead.
After I run bower install
again I get the dependency in bower_components (which is where ember-cli is looking for it.)
Same thing here, it appears that bower_components is completely emptied out. I see some of the files in the node_modules folder, but not the majority of them, matching what I see from yarn ls
, I think it might be coincidence that some packages match? Running v0.15.1 on a mac.
If yarn interacts with bower, could that be in the documentation somewhere? I can't even find the word "bower" in the docs. And it only shows up in any description in the repo here
@skuridin do they appear in the listing when you run yarn ls?
nope
I made a very simple repo to demonstrate this issue with a single bower.json and a single package.json dependency: https://github.com/RustyToms/yarn-issue-616
What seems to be happening here is bower is being added as a registry. All the folders in the registries, including bower_components
are being set as possibleExtraneous. Then, if those files weren't included in the files that yarn is building, they are deemed to be actually extraneous and are deleted.
The main problem seems to be that bower.json dependencies don't seem to be properly loaded into the set of dependencies that yarn is collecting.
Tried on our project.
We have a bower.json + package.json and we have the same behavior. We are also using .bowerrc (output to "libs" folder) and this folder also get removed.
As soon as this is fixed, we can transition on our team.
Ran into a fairly weird version of this bug. My project doesn't use bower, but a collaborator used it once to install a dependency. They made a .bowerrc
file like the following:
{
"directory": "js/"
}
so that it would be installed in the js
directory with the application code. I had moved the dependency to node_modules
with the others, but forgot the .bowerrc
file because it's hidden. Running yarn
ended up deleting all of my application code; as there was no output indicating .bowerrc
was being read, it took quite some time to figure a hidden file for a program that isn't part of my current workflow was to blame.
Deleting extraneous module locations makes a certain amount of sense, but doing so silently (a confirmation before delete would be ideal, but at least logging what's happening would have saved me a fair bit of time) is rather user-unfriendly鈥攁t least in edge cases like this one.
Since yarn 0.16 it's possible to hook in bower install and make this a bit less distracting while we wait for a proper fix. In package.json:
{
"scripts": {
"postinstall": "bower install"
}
}
Same issue here.
yarn version 16.1
Ubuntu 16.04
We've removed support for Bower, see #1441.
Same issue here.
Why should I use only bower or yarn? why not both?!
I have (old) packages in bower_components/ directory and I want to replace npm with yarn (I can use npm with bower).
You can use yarn and bower. We just have to wait for a new tag.
Why should I use only bower or yarn? why not both?!
That will be possible with the next release of yarn because Yarn won鈥檛 take care of your Bower packages. See #1441
Tip: Use yarn install
and define bower install
as postinstall
script in your package.json
.
OK! I'm sorry!!! :+1:
Thanks!!!
I didn't expect this kind of behavior. I was excited about yarn. But after wasting half an hour figuring out where my bower_components go I gave up on yarn.
Out of curiosity, when will the next, non-bower_components-removing, version of Yarn be released?
Thanks
bump
Please publish the version that fixes bower, this is really blocking here :(
Just use the workaround with postinstall. Works like a charm. Anyway: bower support will be dropped, so the workaround is your only option.
@omnisite problem is that yarn add something
will clean bower_components directory as well and workaround won't solve that
Ah ok. Well, you can always just edit the package and bower json file. I know "add" is easier, but there is just not much choice if Yarn is dropping support for Bower.
@omnisite you can do all sort of hacks like run yarn
right after yarn add
but that's not the point, as yarn is not supporting bower then it should not mess with bower_components folder and prevent a lot of confusion in Polymer and other bower infected communities all around the globe.
Therefore prompt release would be more than appreciated 馃槈
Thanks!
@elmariofredo Yes, I agree. I was bummed also that it did not work out of the box. Still I can work with both with the workaround. And we have no idea when they will fix it.
@omnisite sure just please mind that OSS is driven by community comments and stating
Works like a charm
is IMHO not exactly fitting this case
@omnisite Your workaround does not work in my case, as bower dependencies are commited within the repo (we don't like to rely on the bower tool on each build as we had issues with it from time to time).
yarn deprecating bower support is just fine for me, as long as it does not mess with it.
Also, it seems to be done already, so why not release?
https://github.com/yarnpkg/yarn/pulls?utf8=%E2%9C%93&q=is%3Apr%20is%3Aclosed%20bower
Yes. It would be cool, if you could release yarn without bower support (and without messing with the bower_components dir).
I ran into this problem myself while traveling offline. yarn鈥檚 offline mode was the primary reason to use yarn in the first place. Without a local backup I had not been able to restore bower_components. This is serious. The workarounds from the comments above don鈥檛 work offline.
Thanks!
@dennisfrank Thanks for saying that.
I'm tempted to offer a bounty for someone re-instating and completing bower support. It's still widely used, even if it is being deprecated in a lot of places. And its ability to have repeatable installs is very poor.
I don't think the biggest problem is missing Bower, it's the unexpected deletion of the bower directory :/
Not really sure why this isn't seen as a critical enough issue to release a new (minor) tag for, this can cause serious problems for someone who isn't using version control.
@barryvdh Exactly. But even if you you use version control the bower directory often gets ignored on purpose.
Once this get published, I'm ditching npm for our team. Meanwhile? I'll wait,
Not sure what is blocking the release or the target eta. With an early library like this it would be better to see them make changes faster. This has been sitting for a month.
No idea. In the mid time, this is preventing adoption.
It's released with version 0.17.0 馃帀
YES. Version 0.17.0 have fixed this. Already upgraded.
yes... it is true guys. yarn is safe for bower users. thanks yarn team
Updated yarn to latest with:
npm install -g yarn
Ran yarn --version
and it resolved to 0.17.0
.
Ran yarn
on my solution and only detected 1 change: yarn.lock
You guys rock. We're putting a change in our backlog to change to yarn today. 馃槃
Most helpful comment
Since yarn 0.16 it's possible to hook in bower install and make this a bit less distracting while we wait for a proper fix. In package.json: