Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Yarn ignore-engines for specific packages

Tags:

When installing dependencies using yarn, one package (newrelic) gives the following error:

[email protected]: The engine "node" is incompatible with this module. Expected version ">=6.0.0 <11.0.0". Got "11.13.0" 

The only workaround to this I could find is to run

yarn install --ignore-engines 

However, this would ignore engine mismatch across packages. Is there any way to ignore it only for a specific package?

like image 390
Pravesh Jain Avatar asked Mar 29 '19 14:03

Pravesh Jain


People also ask

What does yarn -- ignore engines do?

The yarn install -ignore-engines command will ignore engines check. This command will ensure that yarn does notinstall optional dependencies. This command run yarn install in offline mode. This command will disable interactive prompts, such as when there's an invalid version of a dependency.

Which is better yarn or npm?

While NPM installs packages sequentially, Yarn performs parallel installation resulting in better speed and performance. NPM has tried to fix vulnerabilities, but still, Yarn is considered more secure than NPM. Yarn also comes with advanced features like Plug'n'Play and Zero-Install.

How do I skip a package in npm install?

To skip Installation of devDepenencies pass --production flag to npm install ,with the --production flag(or NODE_ENV environment variable set to production ) npm will not install modules listed in devDependencies." To make any module to be part of devDependencies pass --dev while installing.

Does yarn support all npm packages?

Yarn can consume the same package. json format as npm, and can install any package from the npm registry. This will lay out your node_modules folder using Yarn's resolution algorithm that is compatible with the node. js module resolution algorithm.


1 Answers

There doesn't appear to be a way to provide package-specific flags on the install command.

However, you can try adding the problematic packages with the flag and followup with a normal install afterwards.

yarn add <problematic packages> --ignore-engines yarn install 

By default, unless --force is provided as a flag to yarn install, packages that already are installed will not be fetched again.

like image 159
Jordan Avatar answered Oct 06 '22 23:10

Jordan