How to fix this npm error trying to update - node.js

leolemus#Leos-MBP-2 ~ % npm install -g npm#latest
npm does not support Node.js v15.11.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.
You can find the latest version at https://nodejs.org/
npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: npm#8.3.0
npm ERR! notsup Not compatible with your version of node/npm: npm#8.3.0
npm ERR! notsup Required: {"node":"^12.13.0 || ^14.15.0 || >=16"}
npm ERR! notsup Actual: {"npm":"8.3.0","node":"v15.11.0"}
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/leolemus/.npm/_logs/2021-12-12T02_35_45_442Z-debug-0.log
I use macos 11.2.2 And I have node installed via homebrew. It says it's up to date when I do "brew upgrade node".

You can always check which version you're using with:
node --version
If you're not using the Node you installed you can unlink the version you don't want with
brew unlink node
Install the node version you want:
brew install node#version
Then link to it with:
brew link node#version
Validate you're using it with:
node --version

Related

Issue when I try to execute npm install

when I run the command npm install, it displays this error:
[log#server:www]$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: vue#2.6.14
npm ERR! node_modules/vue
npm ERR! dev vue#"^2.5.17" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue#"^3.0.0" from vee-validate#4.4.4
npm ERR! node_modules/vee-validate
npm ERR! vee-validate#"^4.2.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /root/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-06-09T01_39_40_386Z-debug.log
I wonder, how can I fix it? What does it mean?
Thanks
It looks like you're trying to install vee-validate version 4.0 in a Vue 2.x application. You can see the compatible version in the vee-validate repo.
How to fix:
Option 1:
Install an older version of Vee-validate (v2 or v3).
First, you'll need to uninstall the version you currently have installed (I'm assuming you installed vee-validate#next since that's the doc recommendation)
npm uninstall vee-validate#next
You can then find the list of versions available with
npm info vee-validate versions
Finally, install an older version with
npm install vee-validate#3.4.9
Replace the 3.4.9 with whatever version you would like to install - as of the time of writing, 3.4.9 is the latest stable tag
Option 2:
Upgrade from Vue 2 to Vue 3 following the upgrade guide.
Note that this is still a work in progress and may have some stability issues and depending on the state of the project I would consider using the above option for the time being.
Step:-1 Make sure node.js is installed on your system. You can check with the command npm --version or node --version
Step:-2 Clear npm cache. run this command npm cache clear -f
Step:-3 Then try to run npm install

After Upgrading my npm from version 6 to version 7 (node version was 10) I cant install dependencies for some projects

I had node version 10 installed in my system, after upgrading my npm from version 6 to version 7 I couldn't install the dependencies, and I'm getting error so I had to downgrade my node to 6,
(both npm ci and npm i was failing)
And the project I was testing is this:
https://github.com/Giveth/feathers-giveth
the errors were something like this:
npm ERR! code 128
npm ERR! git dep preparation failed
npm ERR! command /Users/username/.nvm/versions/node/v10.23.0/bin/node /Users/username/.nvm/versions/node/v10.23.0/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/Users/username/.npm/_cacache --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm ERR! code 128
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command git clone --mirror -q ssh://git#github.com/gulpjs/gulp.git /Users/renjer/.npm/_cacache/_cacache/tmp/git-clone-dfb83c15/.git
npm ERR! npm ERR! fatal: destination path '/Users/username/.npm/_cacache/_cacache/tmp/git-clone-dfb83c15/.git' already exists and is not an empty directory.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! /Users/username/.npm/_cacache/_logs/2021-02-18T16_18_35_855Z-debug.log
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/username/.npm/_logs/2021-02-18T16_20_15_536Z-debug.log
This problem usually happen because if you only upgrade the node version of the system, there are some packages and dependencies that are installed according to that version.
This is a manual process, but you have to install the package according that version.
For example (package.json):
In your node 6 version you have some package:
"xyz":^1.2.3
that package was installed and its dependencies to work with node 6
delete manually that package from your package.json and install it manually like
npm install xyz
Then is possible that you notice an upgrade to the version, something like:
"xyz":^4.5.6
Do that for everyone of your packages and probably your problem disappears. That's the way that I have used to solve that problem.
You can also upgrade all the packages to its lasts version but ... if you have many packages and someone is not working you are not going to know which one is failing, and you are going to check it individually.
Maybe (at the moment of writing this answer) if you are using Node 10, the latest package's version is not going to work either because that version could be fixed to work with Node 16 (the LTS (Long term support) version at the moment of writing this answer).
If you haven't done that yet, I suggest to continually upgrade your system to the some LTS version that isn't deprecated.

Unsupported engine node / NPM only when building in Docker

I have a dependency in my package.json which itself has the following dependency:
"node-rdkafka": "^2.5.0",
Using nvm on my local machine and setting my node version to 8.9.1, and my npm version is 5.5.1, I can successfully run
npm install node-rdkafka#2.7.1
But when running the same thing (i.e npm install) from within my docker image:
FROM node:10.13.0-alpine or FROM node:8.9.1-alpine
I get the following error:
npm ERR! notsup Unsupported engine for node-rdkafka#2.7.1: wanted: {"node":">=12.0.0"} (current: {"node":"10.13.0","npm":"6.4.1"})
npm ERR! notsup Not compatible with your version of node/npm: node-rdkafka#2.7.1
npm ERR! notsup Not compatible with your version of node/npm: node-rdkafka#2.7.1
npm ERR! notsup Required: {"node":">=12.0.0"}
npm ERR! notsup Actual: {"npm":"6.4.1","node":"10.13.0"}
Any ideas about this inconsistency?
I clearly dont need a node version this high. But it says I do.
Try to remove package-lock.json before npm install in Docker
rm package-lock.json
npm i
The engines property in the package.json allows us to establish a range of versions.
With >=12 is asking for a node with version 12 or greater.
Therefore, the solution would be to install the requested version:
FROM node:12
Anyway, I recommend reviewing the versions supported by Docker currently here.

How to fix 'npm does not support Node.js v11.14.0 error' on Windows?

I am configuring my react-native environment. I am attempting to run the react-native command line as described in Facebook's Github documentation here
I have installed the latest version of node.js when I type C:\WINDOWS\system32>node -v v11.14. is returned.
The npm downloaded was included with the latest version of node.js. However it is only 5.5.1. When I input C:\WINDOWS\system32>npm -v the result is 5.5.1
I've tried to uninstall and reinstall
I've tried to download the LTS version of node.js
I've tried to upgrade both node.js and npm
This is for Windows 10
This is running from the administrative command prompt and administrative power shell
This is the code
C:\WINDOWS\system32>npm install -g react-native-cli
npm WARN npm npm does not support Node.js v10.15.3
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! Cannot read property 'startsWith' of null
npm ERR! A complete log of this run can be found in:
When I attempt to clean the cache with npm cache clean -f this is the result
C:\WINDOWS\system32>npm cache clean -f
npm WARN npm npm does not support Node.js v10.15.3
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN using --force I sure hope you know what you are doing.
Edits
The following code is a result of some of the proposed solutions
C:\WINDOWS\system32>npm install -g npm
npm WARN npm npm does not support Node.js v11.14.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! Cannot read property 'startsWith' of null
npm ERR! A complete log of this run can be found in:
C:\WINDOWS\system32>npm install -g npm-windows-upgrade
npm WARN npm npm does not support Node.js v11.14.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! Cannot read property 'startsWith' of null
npm ERR! A complete log of this run can be found in:
C:\WINDOWS\system32>npm install -g npm-windows-upgrade
npm WARN npm npm does not support Node.js v11.14.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8.
npm WARN npm You can find the latest version at https://nodejs.org/
npm ERR! Cannot read property 'startsWith' of null
npm ERR! A complete log of this run can be found in:
I expect to open the npm command line interface. I am receiving errors when I attempt to call the interface.
After installing current NodeJS LTS, I still get
npm does not support Node.js {version}.
I deleted all files in C:\Users\{user}\AppData\Roaming\npm\ and it works.
npm install -g npm-windows-upgrade
npm-windows-upgrade
I deleted node and npm from C:\Users{name}\AppData\Roaming. Then i reinstalled an older version node.js v10.15.3 and npm 6.4.1.
This brings up a different error so I'll be closing this issue...
C:\>npm install -g expo-cli
npm ERR! Cannot read property 'startsWith' of null
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dnort\AppData\Roaming\npm-cache\_logs\2019-04-15T06_32_09_154Z-
debug.log
Simple solution is upgrade your npm version or second option is downgrade your node version.
Download older node version from here
https://nodejs.org/en/download/releases/
How do I update npm?
npm install -g npm
Please note that this command will remove your current version of npm.
Make sure to use sudo npm install -g npm if on a Mac.
You can also update all outdated local packages by doing npm
update without any arguments, or global packages by doing npm update
-g.
Occasionally, the version of npm will progress such that the current
version cannot be properly installed with the version that you have
installed already. (Consider, if there is ever a bug in the update
command.) In those cases, you can do this
You are using an old version of npm. Please upgrade it to the latest.
I faced the same issue using npm, so I was thinking about the alternative of npm. And, you might give the yarn a try.
Firstly, going to https://nodejs.org/en/ to download the nodejs with the LTS version.
Secondly, going to https://yarnpkg.com to download the msi file with the stable version.
Note that the current version of nodejs and yarn are 10.16.0 LTS and 1.17.3 respectively.
After installation, you can install your project packages by using yarn install instead of npm install.
Had the same issue with latest version.
Remove all the NodeJS installation.
For now npm supports node js versions 6, 8, 9, 10, 11.
Go to this version (or older) download the msi file and then do npm install.

Unable to upgrade - slimerjs missing...?

I'm running on OSX (El Capitan) with node v5.0.0 and npm v3.3.9. if I attempt an upgrade:
npm upgrade
I get the error below:
npm WARN deprecated lodash#0.9.2: lodash#<2.0.0 is no longer
maintained. Upgrade to lodash#^3.0.0
npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/Cellar/node/5.0.0/bin/node" "/usr/local/bin/npm"
"upgrade"
npm ERR! node v5.0.0
npm ERR! npm v3.3.9
npm ERR! code EREADFILE
npm ERR! Error extracting /Users/ekkis/.npm/slimerjs/0.9.5/package.tgz
archive: ENOENT: no such file or directory, open
'/Users/ekkis/.npm/slimerjs/0.9.5/package.tgz'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! [https://github.com/npm/npm/issues]
npm ERR! Please include the following file with any support request:
npm ERR! /Users/ekkis/Downloads/client-side-testing-0.1/npm-debug.log
I've tried uninstalling this slimerjs (whatever that is) both locally and globally but it still fails. if I look in the given directory there is indeed no 0.9.5 installed but I do find a 0.9.6
so what requires it and why isn't it satisfied with the later version? and most importantly, how do I fix it?
someone suggested 3.3.9 was rather behind the times. upgrading (now v.3.5.2) seemed to solve the problem:
sudo npm install -g npm
The problem is known in the NPM project here - https://github.com/npm/npm/issues/10057. There's an issue with npm#3.x when installing packages having "latest" set to a pre release version.
My fix was to downgrade npm to 2.14.10 - the latest stable in the 2.x series since there was no fix yet posted.
sudo npm install -g npm#2.14.10
for timebeing, Install specific version of slimmerjs eg. npm install slimerjs#0.9.5
https://github.com/graingert/slimerjs/issues/34

Resources