-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 for Yarn package manager #337
Comments
So would I. This feature will be coming soon. |
👍 If I may suggest, maybe an ENV config variable like |
Fact please. |
@kane-thornwyrd the website has tons of facts for you: https://yarnpkg.com/ |
Oh, and if I may suggest again, the presence of a yarn.lock file should automatically use yarn for you. 😊 |
Performance: https://yarnpkg.com/en/compare (try it locally, results are insane) |
Sorry everyone if it may sound like defiance, I think that's a good thing to add Yarn to Heroku, and anyway my opinion does not count about this, and sorry to clutter this demand, I just seek some rock solid facts about yarn among its early supporters. @intellix thank you for your answers, I have more indepth questions: Performances Without a proper protocol, checking which servers are requested, the network quality during the tests and some other data, I'm not particullary receptive to this kind of graph. Reliable In 3 years the only package manager related issue I witnessed, among my heteroclite teams (Ubuntu, Fedora, Win7, Win10,Debian over SSH on Win7, OS X...), was all the binary dependencies requiring node-gyp/Visual Studio/XCode/etc.
Would ruin your day, am I wrong ? more Secure ? |
More secure because it records checksums of installed packages on update and verifies on install. This prevents a man in the middle from substituting a rogue package. |
Typical npm version issues result from loose package.json (*, >=, ^) that result in different versions when installed at different times. In teams that religiously npm install after each pull and clear out old versions, this may not be an issue. |
@technomage : thank you for your answer, I don't get how yarn is supposed to authenticate packages since it is supposed to support custom repos, then I guess it use the sha-1 digest to ensure a proper download, as npm. That does not prevent a MitM attack. Does it store the hashes ? Then how it is supposed to be aware of the new ones from a minor release ? |
This discussion is getting into the weeds. We at Heroku, and more importantly our users, feel the same pains with npm as described in Facebook's announcement. We're very excited about Yarn and will be adding support for it (I'm working on that right at this moment). Everything has tradeoffs, but there are better places to discuss them :) |
Give it a shot:
|
@hunterloftis Works well here - thanks for the super-fast turnaround on this :) |
@hunterloftis The Side note: On CircleCI (our continuous integration software) we had to specify '- yarn run postinstall' in our post declarations. |
Only fact needed is to know Yehuda Katz (Bundler, Cargo) is involved. Thanks for your help |
Any status on this being merged in and a new version cut so that I can put it into my build system? |
@hunterloftis this works well! Only issue, as @parse mentioned this doesn't run |
This has been fixed in v0.16.0 that was released a day ago. See yarnpkg/yarn#800 |
Yep, this works @hunterloftis. Maybe include a version check looking at |
@hunterloftis thanks for getting this out so fast! I've discovered a problem related to caching, and pushed a minimal example with steps to reproduce the issue: https://github.com/mhuebert/heroku-yarn-test The gist: if a project depends on "bcrypt", the first build/heroku-push will work, but subsequent builds (after changing dependencies) will fail with an error:
After this happens, the only way I can get any subsequent build to work is by using heroku-repo to purge the cache ( I do see a recent related issue on yarn, however I don't see this error when I run locally (and I am also on Sierra), nor on CircleCi. |
I've been running into the bcrypt problem as well on my codeship builds, so I don't think it's a heroku problem. Something is wrong with the way yarn replaces the bindings when it re-runs install scripts. I had to start deleting my node_modules folder before every build. |
This will disable the cache (for modules like bcrypt that don't yet work well with yarn's cache):
|
I've set:
But the deploy fails. Any tips?
|
@kane-thornwyrd here are practical CI benchmarks for yarn, if these haven't already been linked somewhere above: https://medium.freecodecamp.com/npm-vs-yarn-benchmark-9b456de4aa96#.sa32q3heg |
@kane-thornwyrd I ran into more issues with |
@joneslee85 as @hunterloftis said, there is other places to discuss this topic. |
This is my package.json, not exactly anything crazy:
|
@AndrewBarba I think I missed something here. Isn't the issue that you don't want dev dependencies installed on production? From your |
@natecox Someone else made that comment, in a previous comment I said that we didn't have any dev dependencies and it is still breaking for us. First person to mention there was an issue said that a config var was being ignored, but that is an open issue in Yarn. For me, i Just want production dependencies, and on a clean installation of yarn, no node modules folder, running Previous comment for reference, sorry for confusion!
|
Ah, got it. |
@AndrewBarba yarn relies on a lockfile. What does yours look like? |
@hunterloftis Yes, I'm aware. Thats why this is so concerning. The whole point of Yarn is to install exactly what is in the lock file. The same one checked into source, on all dev machines, and Heroku. When everything runs locally, all CI passes, Heroku build passes, server goes to start and THAT's where it breaks down... not fun. If build breaks, fine. But thinking the build/install was successful and deploying to all dynos? Terrifying. Here is lock: https://assets.tablelist.com/fyre/yarn.lock.zip |
Okay digging into actual build logs, this is what a successful looks like (was able to get this to succeed just now on a dev app with NODE_ENV=development):
And this is what the build looked like when the app couldn't start:
So something strange going on between the two builds. Almost like it thought that it cached deps on my production app |
I was just able to deploy to my production app with |
I guess I spoke to soon. Getting Edit: yes that worked. |
I think in light of all the issues people are experiencing, maybe the build pack should not automatically use |
@hunterloftis I was unable to deploy my node/yarn application and setting the build pack back to pre-yarn was only solution mentioned here that worked. Otherwise crashed when trying to start the express server.
Npm install worked fine. |
We just had to remove the I guess we'll wait a bit longer until yarn is more stable. |
Are you using the master branch? We were using yarn branch but it seems the master branch supports yarn now. It's been working for us. |
Yes, master branch |
yeah and it does respect yarn version put under engines
|
For anyone else searching, I found a couple more workarounds until this issue gets fixed:
OR
|
Same here! Build is failing because the app requires any private modules...maybe a warning ahead by Heroku was in place here. A relative new tool like Yarn still has a lot of rough edges, maybe wait for a couple of months to merge such thing in a production platform or make it a beta feature for users who want to run their app on the wild side of things. |
@robinvdvleuten you can opt out of using yarn by adding |
I'm guessing Heroku didn't know that yarn doesn't support private github modules - which quite a lot of people use |
@freeall @robinvdvleuten yes, we're aware that yarn doesn't support private modules. Why are you using yarn / have a yarn.lock file in the root of your project, if you are relying on functionality that yarn doesn't yet support? Yarn is only used in the buildpack if you check Yarn is a new technology, and while it's building the vast majority of apps faster and with determinism, it may not be suited for your project. If you want to have a |
Yarn updates: |
Looks like there's another problem when a |
Can't say that much about Yarn! Thanks landscapersParis is also on slack as known as geeks gardens and landscapers |
It seems to me that if I use the default cache settings, any packages with native bindings will fail after the first deploy. Disabling the module cache fixes this (as many have noted) but I'm curious if anyone has figured out a way to make the cache play nicely with native bindings now that it's been a few months. |
Yarn is a new package manager -- an npm replacement -- by Facebook and Google. It's faster, more reliable and secure than npm. I'd like to use it to manage my Heroku node app dependencies.
The text was updated successfully, but these errors were encountered: