Do you want to request a _feature_ or report a _bug_? Reporting a bug
What is the current behavior? Inconsistency between the version of node which yarn's running on and the current version of node (node --version) may cause errors like
The engine "node" is incompatible with this module. Expected version ">=4.5.0".
If the current behavior is a bug, please provide the steps to reproduce.
vim $(which yarn)console.log(process.versions.node) // for me, the output was 4.2.6 while `node -v` gave v6.7.0
These versions should be different.
yarn add any packages whose engine requirement is satisfied by only one of these two What is the expected behavior?
Yarn should share the same version of node engine.
Please mention your node.js, yarn and operating system version.
node -v: 6.7.0
npm -v: 3.10.8
yarn --version: 0.15.0 which is installed via the Debian package repository
OS: Ubuntu 16.04.1 LTS
Current workaround
Using npm i -g yarn
From my point of view, there should be a heads-up in Installation documentation when installing yarn using package repositories.
@hiendv - did npm i -g yarn solve it for you? I'm getting this error even installing globally/directly from npm.
@leebenson It actually did. Could you please post the results of which yarn and which node?
which yarn
/usr/local/bin/yarn
which node
/usr/local/bin/node
yarn --version
0.15.1
node --version
v6.7.0
On MacOS Sierra 10.12.1 Beta
@leebenson
vim $(which yarn)
var ver = process.versions.node; and print the ver outvar ver = process.versions.node;
console.log(ver)
yarn install again and compare ver to node -vvar ver = process.versions.node;
console.log('ver ->', ver);
Executing yarn:
ver -> 6.7.0
yarn install v0.15.1
info No lockfile found.
[1/4] ๐ Resolving packages...
[2/4] ๐ Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version "^5.3".
error Found incompatible module
info Visit http://yarnpkg.com/en/docs/cli/install for documentation about this command.
Same problem.
Interesting. Your case is different.
1. Why?
[email protected] specifies
"engines": {
"node": "^5.3",
"npm": "^3.5"
}
which is totally incompatible with your node v6.7.0. It's because of the package itself. However, the author already fixed it in the next release.
2. How to resolve?
Use [email protected] instead
"engines": {
"node": ">= 5.3",
"npm": ">= 3.5"
}
nicely spotted! Thanks @hiendv
I've asked the parent package to bump.
I'll look for the patch mentioned here to land too, which should help workaround the issue of deeply nested dependencies with broken engines configs.
You're welcome @leebenson.
Let's hope yarn team will look into my problem soon ;)
The main difference is that npm is shipped with node while yarn isn't.
There's a note about configuring the NodeSource repository but I don't think it's stated clearly and correctly enough.
On Ubuntu 14.04 and Debian Stable, you will also need to configure the NodeSource repository to get a new enough version of Node.js (Debian Testing and Ubuntu 16.04 come packaged with a sufficient version of Node.js, so this step is not required in those environments)
It's true to say if we install nodejs from the NodeSource repository and use it (e.g. /usr/bin/nodejs), we can install yarn from Yarn repository and use it properly. But this is mandatory because there shouldn't be any difference between the version of engine between npm install and yarn install/add
If a user uses another version of node (_and npm_), e.g. ~/.nvm/versions/node/v6.7.0/bin/node, there will be inconsistency.
@leebenson what is strange that quill bumped dependency to [email protected] (seen https://github.com/quilljs/quill/blob/develop/package.json), but yarn add quill, yarn add [email protected] or even yarn add https://github.com/quilljs/quill.gitseems to still load older version and tries to require [email protected] (and fails). I've cleared yarn cache โ did not help (
Inconsistency between the version of node which yarn's running on and the current version of node (node --version) may cause errors like
The engine "node" is incompatible with this module. Expected version ">=4.5.0".
This sounds confusing... Is it intentional that you have two different Node.js versions? I'd suggest just having a single version of Node.js installed ๐
Is there an issue with our Debian package that's causing it to use the wrong Node.js version?
@Daniel15 do some of the install options come with a specific version of node?
@thejameskyle None of them are bundled with Node. The Debian/Ubuntu package "recommends" the nodejs package (so nodejs will be installed unless the user opts-out from installing recommended packages), but it's not a strict dependency, so users can just install Yarn and use their own Node.js version through nvm or whatever.
Windows installer doesn't check for Node any more, so Yarn will just fail to run if they install Yarn but don't install Node.js.
Going to close this out as #1142 should help with inconsistencies around Node.js in Debian.
@hiendv - To fix your current situation, I think you should apt-get remove nodejs and then symlink /usr/bin/nodejs to whatever version of Node you're using (probably /usr/bin/node or /usr/local/bin/node).
I think the ideal fix is to use the native package management system of your operating system rather than using nvm, unless you have a specific reason to use nvm (eg. if you require multiple versions of Node.js to be installed and accessible).
I think I have the same issue as described here. I do indeed have multiple versions of node installed and it's a hard requirement. We're using meteor which installs its own version of node depending on the meteor version of a given project. We're switching to yarn instead of npm, and in the process, hitting the "error Found incompatible module" error.
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=6".
error Found incompatible module
Here's some additional info to complicate matters:
$ meteor npm -v
4.4.4
$ npm -v
4.6.1
$ meteor node -v
v4.8.1
$ node -v
v7.7.3
$ meteor yarn --version
0.27.5
When I try to run yarn in my project (which did successfully run yesterday) I get the following:
meteor yarn
yarn install v0.27.5
[1/4] Resolving packages...
[2/4] Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=6".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
The react-jsonschema-form packages at version 0.49.0 has an "engines" section which includes "node": ">=6". The version of node that meteor is running is 4.8.1 which is indeed below 6. However, yarn won't install anything because it hits this error and bails.
I can workaround it with yarn --ignore-engines but that's definitely not a solution. I can't reopen this issue, hopefully @Daniel15 or @hiendv will do that as I'd argue this is definitely an issue, and definitely requires a solution. Perhaps adding a way to tell yarn which engine versions it should calculate based on?
Although my opinion remains, I cannot reopen the issue. Looking forward to hearing from @Daniel15
I do indeed have multiple versions of node installed and it's a hard requirement.
Just put your 'preferred' version of Node (ideally the newer one) earlier in your $PATH than the other version.
The react-jsonschema-form packages at version 0.49.0 has an "engines" section which includes "node": ">=6". The version of node that meteor is running is 4.8.1 which is indeed below 6. However, yarn won't install anything because it hits this error and bails.
It's working as expected then? If the package specifies that it only works on Node 6 and above, it should indeed fail on Node 4.8.1. Sorry if I'm missing something here. If the package works on an older version, they should not have that section in the package.json.
@Daniel15 Haha, you're right, that is a greater than, not a less than! It's not always possible to change the $PATH. In our case, it's modified by both meteor and npm, which is why we can install yarn as a local dependency without having to install it system wide.
Can Meteor upgrade its archaic Node.js version to a more modern one? I feel like this is actually a Meteor issue and not a Yarn issue.
@Daniel15: The next release will upgrade node, but I think the more general use case of specifying which version of node yarn should consider as "installed" is what's at issue here. In my opinion, it's a very valid scenario to have multiple versions of node installed and to want to specify which one yarn should use for engines checks.
it's a very valid scenario to have multiple versions of node installed and to want to specify which one yarn should use for engines checks.
How would you specify which one to use though?
I agree that it's a valid scenario to have multiple versions of Node.js installed, however I feel like it's extremely uncommon to run one version of Node.js while installing packages for a totally different version of Node.js (eg. using Node 4 to install packages that will actually be used on Node 6) ๐
@Daniel15 Hmm, yes, you're right. Makes sense. Fair point. I was going to write up a feature request to specify which version of node should be considered for engine checks, but actually, you make an excellent point. I think this whole thing started because I misread the version constraint and thought something weird was happening, but it wasn't. Sorry for the noise, thanks for the patience.
It worked for me after I installed latest stable version of node ( https://nodejs.org/en/ )
Most helpful comment
@hiendv - did
npm i -g yarnsolve it for you? I'm getting this error even installing globally/directly from npm.