-
Notifications
You must be signed in to change notification settings - Fork 29.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
Use Yarn to manage dependencies #38481
Conversation
finally can build vscode!
related to #38342
@bpasero @Tyriar FYI the |
One tip I found useful: |
|
Concerning this line:
Yarn themselves recommend installing Yarn through other means than the node package manager for Linux and MacOS with the former varying on the distro and the latter having options for both Homebrew and MacPorts. Installing Yarn through I therefore strongly suggest referencing the Yarn installation page for readers that are not using Windows: https://yarnpkg.com/lang/en/docs/install/ |
@favna is there any reason why it should be done that way? |
@felixfbecker I have too little experience with the aforementioned non-Windows environments to be able to properly answer that, therefore I can only assume that if there wasn't a compelling reason to do so then Yarn wouldn't be recommending its users to install it through their recommend ways. |
@favna I could see how they don't want to be "coupled" in any way to npm, i.e. no want to require npm to install yarn, as they are a competitor to npm. It always felt weird using npm to install bower. That is definitely not a reason to "strongly suggest" stop using npm... |
As long as there is no functioning way to self-update Yarn, people will always prefer the npm method, imo. |
@joaomoreno, you should edit this part like so as @octref mentionned : What about
|
@felixfbecker you can find their reasons under „Install with npm“ under the alternatives tab on the installation docs |
cc @felixfbecker
We moved to Yarn to manage our dependencies. The big advantage is, of course, speed. I report 3x faster
install
times on my macOS machine. There are other consequences such as locking down our dev dependencies (which sometimes bite us: #37698, et al).For everyone in @Microsoft/vscode, please read:
What do I have to do?
npm i -g yarn
git clean -xfd
yarn
. You can now have a very short espresso ☕️ while you wait Compare that to the tall venti moccachino soy latte from the good old npm 4 times. Too many calories.You're good to go.
FAQ
How do I do
./scripts/npm.sh install
now?Just:
Pretty cool, amirite?
I've also adapted
scripts/npm.{sh,bat}
to simply invoke yarn for the sanity of your own muscle memory.What about
npm run TASK
?You can still do that. No problem.
How can I add or update a dependency?
Both installing and updating dependencies are the same command:
Example:
As always, carefully review the changes made to
package.json
and (now)yarn.lock
files before blindly committing them when adding or updating dependencies.What are
yarn.lock
files?They replace our shrinkwrap files and represent a snapshot of the dependencies to install when installing... dependencies. You don't touch them. Only Yarn touches them.
Can I manually edit dependencies in
package.json
oryarn.lock
?No, since those files should only be managed by Yarn itself.
On Windows,
yarn
fails withEBUSY
errorsYarn tries to parallelise native module compilation in order to be faster.
node-gyp
doesn't like this on Windows. You can setCHILD_CONCURRENCY
to1
in your user's environment to fix this.Why not NPM5?
Basically because of npm/npm#17722
As always, please be alert to any runtime errors, missing dependencies, strangeness; and let me know asap.