everyone.
I am upgrading Node.js and npm in my Ubuntu 18.04.6 server, but I'm running into a strange problem.
I was using the process as indicated in the installation guides:
To install Node.js version 17.2.0, I use
curl -fsSL https://deb.nodesource.com/setup_17.x | sudo -E bash -
sudo apt-get install -y nodejs
Then, to install npm version, I use
npm install -g npm
However, after this, when I try to use npm to install modules, I get the warning
npm does not support Node.js v14.4.0
You should probably upgrade to a newer version of node as we
can't make any promises that npm will work with this version.
Checking the versions of node, I find that
node --version
yields v14.4.0, but
nodejs --version
yields v17.2.0.
How do I fix it so node will point to the latest version and/or so npm will use the correct version of node?
I had also tried a lot for upgrading node version from 14 to 18. But even after installing latest version and following various procedures my version of node was showing 14.4.0 only.
Luckily following three node version manager commands solved my problem on my ubuntu machine v20.04.4:
1. curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
2. command -v nvm
3. nvm install node
Now check node has been updated to latest version and can be verified with node --version.
If you still find an old version even on installing new latest/lts version, then check which node version is set as default with following command:
nvm ls
you will see green colored version text set with an arrow in front of it. It will also show other versions which have installed recently like v16.15.0, v18.2.0, etc.
Change the node version you want to set by following command:
nvm alias default v18.2.0
After this close the terminal and restart the new terminal and try checking node JS version. Here you got you want..!!
I had node installed in my machine and everything was working fine. During an online course made in 2019, the instructor was using an earlier version of npm (v5.5.1) and advised everyone to use the same version with him for follow up reasons. So I downgraded to v5.5.1 but now I keep getting one same error (incompatibility) for almost all commands. I read some solutions to similar problems here and even tried extra steps but the problem still persists.
I uninstalled node from my system, restarted the system and reinstalled node but the version of npm still remained v5.5.1.
I tried to uninstall npm from the command line npm uninstall -g npm but it threw incompatibility error.
I searched the web for compatible version of node.js for npm v5.5.1 and got node v10.15.1 which I downloaded installed with several system restarts but my node and npm still remain incompatible. Please what can I do?
You should use nvm which is the Node Version Manager, cURL:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
commands:
nvm install <version> Download and install a <version>
nvm use <version> Modify PATH to use <version>
nvm ls List versions (installed versions are blue)
Helpful reads:
How can the default node version be set using NVM?
How to change node version with nvm
I am getting below yarn error when deploying to AWS
error fs-extra#7.0.1: The engine "node" is incompatible with this module. Expected version ">=6 <7 || >=8". Got "7.0.0"
Any idea how will this be resolved?
Will this work out if I specify engine in package.json
{
"engines" : {
"node" : ">=8.0.0"
}
}
You can try to ignore the engines :
$ yarn install --ignore-engines
OR
$ yarn global add <your app> --ignore-engines
You can see all what you can ignore by running:
$ yarn help | grep -- --ignore
--ignore-scripts don't run lifecycle scripts
--ignore-platform ignore platform checks
--ignore-engines ignore engines check
--ignore-optional ignore optional dependencies
You need to upgrade your version of node.
I ran into this same issue.
If you used Homebrew run:
brew update # This updates Homebrew to latest version
brew upgrade node
If you use nvm run:
nvm current node -v # Checks your current version
nvm install <version> # Example: nvm install 12.14.1
For the above step go to https://nodejs.org/en/download/
Grab a version which satisfies the conditionals in your error, the latest version should work.
More Detailed Walkthrough: https://flaviocopes.com/how-to-update-node/
A fix that is a hack can be
yarn config set ignore-engines true
However if you want a permanent solution is to :
delete node_modules/, package-lock.json & yarn.lock
run yarn install or npm i again.
Add --ignore-engines to the suffix while installing the package like this:
yarn add <package_name> --ignore-engines
My problem was solved with yarn --ignore-engines, but I'm not sure why and how.
I had a similar issue on Ubuntu even after installing Nodejs many times with the latest version, it was showing always the same old Nodejs version; I discovered it was installing the similar old Debian package each time, even after executing the apt-get update command
Finally, I got it to work by purging the old nodeJs then adding different repository source, and installing nodeJs normally with the new distribution as follows:
sudo apt-get purge --auto-remove nodejs
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
Please find the list of all NodeJs distribution below
https://github.com/nodesource/distributions/blob/master/README.md
You may find other ways of doing the update, but this one worked for me.
I do NOT recommend using this:
% yarn install --ignore-engines
It avoids the issue instead of solving it.
A possible solution would be to update your node to version > 8.0.
% brew upgrade node
Or you could try installing multiple versions of node by using nodenv, in case you need them for other projects.
% brew install nodenv
% nodenv init
# Load nodenv automatically by appending
# the following to ~/.zshrc:
eval "$(nodenv init -)"
% nodenv install 6.0.0 //or some other version
Lots of answers say to set flags to ignore the version error.
A better option is to use this as a reminder to update your node version to something recent and supported by the package you want to install.
nvm install 16.16.0 # download & install locally on your system
nvm use 16.16.0 # update current project's .nvmrc file
Note that the 2nd command will update your local .nvmrc which specifies a per-project node version.
The node ecosystem turns over quickly, even "Long Term Support" (LTS) releases stop getting support after about 3 years. Use this page to see the latest LTS release version, and also make sure it matches the node version expected by the package you're installing, from the error message.
You can try:
Open you package.json
find
"engines": { "node": "14.x" }
change 14.x -> >=14.x
I recommend doing what the error message says and checking your Node.js version (node -v). The easiest way to upgrade Node.js is with the n version manager:
$ npm install -g n
Then install the latest (n latest) or LTS (n lts) version of Node.
What worked for me was to update Node to the latest version. Following any tutorial depending on your OS.
Upgrading Node.js to latest version
sudo npm cache clean -f
sudo npm install -g n
sudo n 10.22.1
node -v => Should be on 10.22.1
type what version of node you require as I have just put 10.22.1 as an example
Update your Node.js to the latest version.
https://nodejs.org/en/download/
you need to run the below command and your problem will be solved
yarn install --ignore-engines
or
npm install --ignore-engines
This is a lot more problematic than it seems on the surface.
If you include a module that requires node 6, but you have other modules that use node 11, you will get this error!
It's problematic when it's 3rd party modules you've used nom/yarn/etc. to install, as you don't have access to those package repos without doing git fork.
In my case, I am using yarn workspaces and some of the modules in the package.json files in the workspaces might require foo 1.0 while others require foo 2.0 and the 1.0 version might require node 6 and the 2.0 version might require node 14.
The only solution I found is to use --ignore-engines, though it clearly is what other(s) have posted - that this is not fixing the problem, just ignoring it in spite of any issues that might be caused (node 6 code might not run on node 14!).
Sometimes you cannot upgrade the Node engine (legacy projects, client requirements etc). The solution I found in this case was to downgrade the problematic versions by using "selective dependency resolution", as documented on Yarn:
https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/
{
"name": "project",
"version": "1.0.0",
"dependencies": {
"left-pad": "1.0.0",
"c": "file:../c-1",
"d2": "file:../d2-1"
},
"resolutions": {
"d2/left-pad": "1.1.1",
"c/**/left-pad": "^1.1.2"
}
}
Notice the "resolutions" part. You can force those packages to downgraded versions (compatible with your older Node engine).
I found this problem now, with an old code, however, I solved it with:
yarn upgrade
Just found that not only I need to upgrade the node, but also need to install it.
This upgrades node to latest version:
brew upgrade node
This install the specific version of node:
nvm install 17.0.0
Upgrade your version of node , this issue will be resolved
I'm simply trying to create a react app with the command npx create-react-app my-app
but get this error:
css-loader#1.0.0: The engine "node" is incompatible with this module. Expected version ">= 6.9.0 <7.0.0 || >= 8.9.0". Got "8.5.0"
I've tried updating node but it seems to not work, checking the version it says 8.5.0 just like in the error.
Even restarted my computer as a last option but that also didn't help..
Is there anything else I could try? Any suggestions are welcome.
I had the same thing and spent few hours trying to figure it out. I think it was the webpack. Finally, I ended updating the node.
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Finally realised the problem was my old version of node, I had nvm installed and had to update which node version I'm using with nvm use node.
Update:
I had to use that command every time I started a new terminal session. Also had problems when some other packages were picking up the wrong node version for some reason.
That can be fixed with the command nvm alias default 10.11.0, or which ever version you want to use.
I can confirm that
nvm install node --reinstall-packages-from=node
worked well for me.
I had the same problem, Als tried some stuff and after updating the lates version of node with nvm it worked. I got it from this website: https://bytearcher.com/articles/ways-to-get-the-latest-node.js-version-on-a-mac/
nvm install node --reinstall-packages-from=node
I tried to install node.js by NVM in Ubuntu 16.04 server by following this link. And I got:
root#instance-15s8fbzx:/opt# nodejs --version
v4.2.6
root#instance-15s8fbzx:/opt# npm --version
5.3.0
root#instance-15s8fbzx:/opt# node --version
v8.4.0
Then, we I run a mean-stack project by sudo npm start, I got
class User {
^^^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
Then, I saw this link, I think maybe because the nodejs version is not correct. I have another server with v5.12.0 as the version of nodejs, and the project worked well there.
Then, I tried to do
sudo npm install -g npm
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/8.4.0/bin/node /usr/bin/node
But the version of the nodejs is still 4.2.6. Does anyone know how to upgrade its version to 5.12.0?
After you have installed NVM and you have installed the necessary version of node, you select the node version as follows:
> nvm use v5.12.0
After upgrading to the Nodejs version, the following error occurred for the Laravel and VUE js packages I already had:
PHP Fatal error: During inheritance of IteratorAggregate: Uncaught
ErrorException: Return type of
Symfony\Component\HttpFoundation\ParameterBag::getIterator() should
either be compatible with IteratorAggregate::getIterator():
Traversable, or the #[\ReturnTypeWillChange] attribute should be used
to temporarily suppress the notice in
C:\xampp\htdocs\clerk\vendor\symfony\http-foundation\ParameterBag.php:210
To solve the issue, I did the following:
composer update
npm update
npm run dev
php artisan serve