yarnpkg

What is the difference between yarn.lock and npm's shrinkwrap?

戏子无情 提交于 2019-11-29 20:24:15
Recently I tried installing my Node packages with Yarn. It works great and it's a lot faster than NPM. Yarn automatically generates yarn.lock . We already have NPM shrinkwrap ( npm-shrinkwrap.json ). Is there any difference between them? Does yarn.lock has any advantage over npm-shrinkwrap.json? Aurora0001 The yarn.lock file is quite similar to other package managers' lock files, especially Rust's Cargo package manager, which has Cargo.lock . The idea of these lock files is to represent a consistent set of packages that should always work. npm stores dependency ranges in the package.json file,

How Do I Uninstall Yarn

不羁的心 提交于 2019-11-29 20:01:18
How can I uninstall yarn? I've used it for a react-native project and now whenever I move the code out of index.ios.js or index.android.js it throws an error so I'd like to just use npm but whenever I initialize a react-native project it defaults to yarn. I tried npm uninstall yarn but that didn't work. Thanks. sospedra Depends on how you installed it : brew : brew uninstall yarn tarball : rm -rf "$HOME/.yarn" npm : npm uninstall -g yarn ubuntu : sudo apt-get remove yarn && sudo apt-get purge yarn centos : yum remove yarn windows : choco uninstall yarn Didn't see the answer that worked for me,

How to put Vue.js in production mode using webpack 2.7?

血红的双手。 提交于 2019-11-29 13:32:55
I've got an existing code base in which Vue.js has performance problems. I also see this notice in the browser console: so I guess an easy fix could be to put Vue into production mode. In the suggested link I try to follow the instructions for webpack. We're on Webpack version 2.7 (current stable version is 4.20). In the instructions it says that in Webpack 3 and earlier, you’ll need to use DefinePlugin : var webpack = require('webpack') module.exports = { // ... plugins: [ // ... new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('production') }) ] } So in my package.json I've

Rails precompile assets Yarn executable was not detected

青春壹個敷衍的年華 提交于 2019-11-29 13:17:33
I have a Rails project that we converted from Rails 5.0 to Rails 5.1.0. When I try to precompile the assets, I get the following error message: Yarn executable was not detected in the system. Download Yarn at https://yarnpkg.com/en/docs/install Everything I read from an internet search says yarn and webpacker comes with Rails 5.1. I get the following from check the rails version. $rails --version Rails 5.1.0 How do I fix this? I'd also like to know what is happening. Rails 5.1 comes with SUPPORT for yarn and webpack, but you need to install them yourself. Yarn is a package manager and webpack

How to use webpack with a monorepo (yarnpkg workspaces)

扶醉桌前 提交于 2019-11-29 11:14:55
问题 I'm using yarn workspaces where the root directory has a package directory with all my repos. Each repo has its own node_modules directory containing its dependencies. The root node_modules directory contains all the dev dependencies for the whole project as well as all other dev related things such as webpack.config files. Webpack uses hot module reload for the express server package. The problem I have is, how to configure webpack externals to exclude all node_modules directories through

NPM preinstall script

痞子三分冷 提交于 2019-11-29 06:43:36
I am trying to run some policing script before any packages are installed. For Example: { "name": "pre-hook-check", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "preinstall": "echo preinstall", "postinstall": "echo postinstall" }, "author": "", "license": "ISC", "dependencies": { "abc": "^0.6.1", "preact": "^8.2.5" } } It seems the pre and post install script on above example only works when I do npm install , but I want that to run every time I try to install anything. For example: Let's say I want to write a

Moving away from Bower (discontinued) to use Yarn/Npm instead (.Net Core MVC) VS2017

本小妞迷上赌 提交于 2019-11-29 04:32:22
问题 I started working on a .Net Core application around 1 year ago. I used .Net Core to set up my project in visual studio and used Bower to manage my client side packages. It seems bower is being maintained/discontinued and the "people in charge" suggest using yarn or webpack instead. So my question is how do I start using yarn instead of bower ? (or npm if that is more appropriate) When I started my project I used bower from within the Visual Studio package manager by simply by typing: bower

What is main difference between yarn and npm? [closed]

烈酒焚心 提交于 2019-11-28 23:01:33
I want to ask what is your favorite package manager for JS ? I saw some articles about yarn and npm. But I am not sure what can be better for me. I just start learning JS. Right now difference between yarn and npm is for me like difference between brands of cola. Milos Mosovsky There were times when we had only npm but it had so many issues with resolving dependencies and caching that another tool has born ( yarn ). Usually it was using local cache to resolve dependencies and it was crucial for example while running CI jobs which are almost always ran in same environment and high bandwidth is

How do I override nested dependencies with `yarn`?

一曲冷凌霜 提交于 2019-11-28 18:31:35
If my package has these dependencies { "name": "my-package", "dependencies": { "foobar":"~1.0.3", "baz":"2.0.9" } And the foobar package has these dependencies { "name": "foobar", "dependencies": { "baz":"^2.0.0" } and the most recently released version of baz is 2.1.0 , the first run of yarn will install baz@2.1.0 in foobar/node_modules . How do I force yarn to use the baz@2.0.9 package for foobar ? My understanding is that this would be possible using npm shrinkwrap (a la this question ). The summary of my question probably is: Yarn creates repeatable, deterministic installations, but how do

Why wouldn't I use npm to install yarn?

北城余情 提交于 2019-11-28 18:18:56
问题 In the blog post announcing yarn (an alternative npm client) they say, "The easiest way to get started is to run npm install -g yarn ". But if you go to the "install yarn" page in their docs, "npm install yarn" isn't listed on any of the platform-specific installation pages, and it's only offered as the third of three options on the "Alternatives" page. Furthermore when you npm install yarn it prints a deprecation warning, "It is recommended to install Yarn using the native installation