yarnpkg

Yarn global command not working

霸气de小男生 提交于 2019-11-28 16:25:18
问题 I'm working with Yarn v0.16.1. If I understand correctly (according to the documentation), yarn global add <package> should be the equivalent of npm install -g <package> . However, when I run the example in the docs (with create-react-app ), the command runs successfully but create-react-app is then not available from the command line. Here's the output: $ yarn global add create-react-app $ yarn global v0.16.1 [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking

How to install package with local path by Yarn? It couldn't find package

点点圈 提交于 2019-11-28 16:22:39
问题 In my package.json I'm pointing local package my-custom-i18n by its relative path: package.json "dependencies": { "core-js": "^2.4.1", "my-custom-i18n": "./../MyProject.Shared/myproject-i18n", "rxjs": "5.0.0-beta.12", ... } npm install installs packages correctly, but yarn has problem with it and simply cannot find this package: yarn output $ yarn yarn install v0.15.1 info No lockfile found. [1/4] Resolving packages... error Couldn't find package "myproject-i18n" on the "npm" registry. info

Should I commit yarn.lock and package-lock.json files?

血红的双手。 提交于 2019-11-28 15:56:09
We're using yarn for all our deterministic pkg installations but don't prevent the user from using npm - I'm guessing having both these files will cause issues however. Should one be added to your .gitignore dir? Always commit dependency lock files in general As is covered elsewhere, dependency lock files, which are supported by many package management systems (e.g.: composer and bundler ), should be committed to the codebase in end-of-chain projects - so that each individual trying to run that project is doing so with exactly the tested set of dependencies. It's less clear whether lock files

Rails precompile assets Yarn executable was not detected

泪湿孤枕 提交于 2019-11-28 07:14:10
问题 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. 回答1: Rails 5.1 comes with

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

醉酒当歌 提交于 2019-11-28 03:23:18
问题 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

NPM preinstall script

a 夏天 提交于 2019-11-28 00:31:06
问题 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 ,

Should I commit the yarn.lock file and what is it for?

时光怂恿深爱的人放手 提交于 2019-11-27 17:07:07
Yarn creates a yarn.lock file after you perform a yarn install . Should this be committed to the repository or ignored? What is it for? Yes, you should check it in, see Migrating from npm Yarn will generate a yarn.lock file within the root directory of your package. You don’t need to read or understand this file - just check it into source control. Depends on what your project is: Is your project an application? Then: Yes Is your project a library? If so: No A more elaborate description of this can be found in this GitHub issue where one of the creators of Yarn eg. says: The package.json

How do I override nested dependencies with `yarn`?

被刻印的时光 ゝ 提交于 2019-11-27 11:37:48
问题 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).

Should I commit the yarn.lock file and what is it for?

泪湿孤枕 提交于 2019-11-26 23:55:09
问题 Yarn creates a yarn.lock file after you perform a yarn install . Should this be committed to the repository or ignored? What is it for? 回答1: Yes, you should check it in, see Migrating from npm Yarn will generate a yarn.lock file within the root directory of your package. You don’t need to read or understand this file - just check it into source control. 回答2: Depends on what your project is: Is your project an application? Then: Yes Is your project a library? If so: No A more elaborate