my npm commands aren't working, npm is bugging? - node.js

C:\Users\jason\OneDrive\Documents\Web-Dev-Projects\pinterest-clone>npm install
npm ERR! Windows_NT 10.0.19042
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\jason\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v14.17.6
npm ERR! npm v3.10.10
npm ERR! cb.apply is not a function
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! C:\Users\jason\OneDrive\Documents\Web-Dev-Projects\pinterest-clone\npm-debug.log
I am getting this really annoying error that doesn't even tell me what's wrong with npm. I tried deleting and installing node.js again and running the command npm install but I would still get the error. I even tried running a command to use the latest version of npm and it still wouldn't work (npm install -g npm-windows-upgrade & npm-windows-upgrade).
It seems like npm is just being very buggy and doesn't want to work. Help please.

Based on this very similar issue, you really shouldn't be using npm 3.x with Node 14.
You might want to uninstall Node, ensure there are no traces of Node or npm on your system, then reinstall Node 14 or 16.
They automatically install newer versions of npm (6 or newer).
Also, the npm-windows-upgrade package you mention hasn't been updated in 3 years. Maybe don't use it?

You are definitely not running the latest version of the tools. NPM is in v7 and Node.js is in v16. Uninstall what you have currently installed, and download the latest version (make sure to choose Current not LTS) to install the latest version. Here is the link

I'd switch to a package manager specifically for managing different versions of Node + NPM side-by-side on your machine, which saves you the hassle of having to have 1 global installation that just "has to work" for all your projects.
Linux has nvm (node version manager). Since you're on Windows, you might want to check out the Windows-"fork": https://github.com/coreybutler/nvm-windows.
It should prevent incompatible versions of node and npm being installed together.

Related

What version of NPM is compatible with Node.js v13.6.0?

I am currently using Node.js v13.6.0 in Windows 8. When I am trying to install the NPM package, it's showing this:
npm i npm#6.4.1
npm does not support Node.js v13.6.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 ERR_REQUIRE_ESM
npm ERR! Must use import to load ES Module: C:\Users\microshine\AppData\Roaming\npm\node_modules\npm\node_modules\just-diff\index.mjs
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\microshine\AppData\Local\npm-cache\_logs\2022-04-28T09_17_19_815Z-debug-0.log
My system does not support other versions of Node.js so I have to bear with it. Are there any other alternatives to install NPM with this version of Node?
This same issue happened to me. Then I installed npm#6.12.1, & it works for me so npm install -g npm should fix this issue.
If the problem still happens then try to upgrade to Windows 10 with node v16. it will surely help you.

Unable to perform "sudo npm install --save firebase-admin"

i'm unable to perform sudo npm install --save firebase-admin in terminal. The error I'm getting is:
npm WARN package.json crypto#0.0.3 crypto is also the name of a node core module.
npm WARN package.json express-resource#1.0.0 No repository field.
npm ERR! Error: Invalid Package: expected types/jsonwebtoken but found #types/jsonwebtoken
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache/add-local-tarball.js:161:14
npm ERR! at process._tickCallback (node.js:448:13)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Darwin 16.1.0
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "firebase-admin"
npm ERR! cwd /Users/Henry/work_space/ServerMain
npm ERR! node -v v0.10.38
npm ERR! npm -v 1.4.28
npm ERR! not ok code 0
I don't see types/jsonwebtoken or anything in my package.json file.
I'm suspecting this could be because my node and firebase is out of date?
my node is 1.4.28 and my firebase is 2.4.2. Let me know if you guys have any ideas!
If you're suspecting that your Node is out of date then have you tried to install it with a newer version of Node? - i.e. What Have You Tried?
First of all your Node is not v1.4.28 but v0.10.38 - read your own question, it's right there.
Node 0.10 was released on March 2013 and stopped being maintained on October 2016. Its current status is "End-of-Life" so don't expect it to work for any new modules, unless those modules explicitly state that they work with that version of Node (which this one doesn't) and even then don't expect it to work well. See the Node LTS schedule:
Node 0.10 uses a very old version of V8 (3.14.5.x) so you can't even use modern JavaScript. By contrast Node 7.2.0 uses V8 version 5.4.500.43. See V8 Changelog to know was changed in the meantime.
Even io.js was forked from Node 0.12 because of not incorporating V8 releases fast enough in 0.12 and you're using a version that's even older than that.
There is no reason to use Node 0.10 when new versions are available for free.
If you don't know how to install a newer version of Node then see my tutorial or Node website.

npm installation shown can n't call method 'localeCompare' of undefined

First i installed nodemailer then it shown did n't configure correctly.After that i updated it up-to nodemailer 0.7.1 then it shown can't find mimelib module.Then i try to re-install nodemailer again then i show below error.why is that ..? when i try to install another library.It may occur.
npm ERR! Linux 3.19.0-15-generic
npm ERR! argv "node" "/usr/bin/npm" "install" "nodemailer"
npm ERR! node v0.10.25
npm ERR! npm v3.3.5
npm ERR! Cannot call method 'localeCompare' of undefined
I tried using sudo key word and try to install globally and updated all the packages but it does n't helpful.still same.
I think your issue is the version of node you're using is too old.
I had this issue and used n to run multiple versions of node.
Here's a link to options on how to upgrade node

Error Node downgrading

I am a beginner in development, but I want to become a leading developer of mobile applications ;)
I am on Windows 8. I want to install Cordova but I have to downgrade Node I currently 0.12.x. Version I could see that he had to make a downgrade in 0.10.x. Version
I do a downgrading but when I want to install an earlier version (0.10.32 and others)
npm unistall n
npm install n#0.10.32
I have the following errors:
C:\Users\Jeremy>npm install n#0.10.32
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (
x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "n#0.10.32"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! version not found: n#0.10.32
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Jeremy\npm-debug.log
if your workflow does not involve global npm installs, etc, one approach is to simply use the node.exe executable as a stand-alone -- just grab the version you need from nodejs.org/dist and drop it into the working directory for a particular project. (Node.exe can run without actually 'installing' anything onto the system.)
then you could then specify the version of packages that you need for that version of node.exe like so: npm install foo#0.1.1.

Why does NVM install think I am using the wrong version of Node?

While trying to install the less node module globally via the Node Package Manager, I ran into an interesting problem that I am having trouble solving. Basically, I am getting an error that claims the node module, less, is incompatible with my version of node. It says I am using node v0.6.12 and that it requires at least v0.8.0 to work.
First I made sure that I was using one of the latest versions of Node:
nvm use v0.10.11
Now using node v0.10.11
node -v
v0.10.11
Then I tried to install the less module globally:
sudo npm install -g less
And got this error message:
npm ERR! error installing less#1.4.0
npm ERR! error rolling back less#1.4.0 Error: UNKNOWN, unknown error '/usr/local/lib/node_modules/less'
npm ERR! Unsupported
npm ERR! Not compatible with your version of node/npm: request#2.21.0
npm ERR! Required: ["node >= 0.8.0"]
npm ERR! Actual: {"npm":"1.1.4","node":"0.6.12"}
npm ERR!
npm ERR! System Linux 3.2.0-45-generic
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "less"
npm ERR! cwd /home/derek
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! code ENOTSUP
npm ERR! message Unsupported
npm ERR! errno {}
npm not ok
Here you can see that the node package manager is trying to install less using (or thinks it is using) node v0.6.12. It seems as though some others have run into this problem, but his problem turned out to be that he had previously installed node via apt-get, and was resolved by him using the Node Version Manager. I initially installed Node via NVM, however.the Any help that you guys could offer would be greatly appreciated.
Note: It is worth mentioning that it will successfully install using npm install -g less, without sudo permissions. However, as soon as another terminal is opened, the less node module is removed from /usr/local/lib/node_modules, rendering it useless.
Have you tired completely removing the old version, v0.6.12 with something like
sudo apt-get purge node.
I'm not a great with linux, but it seems sudo still has the old version of node in its path and calling npm under sudo is finding it and trying to use it.
The Node.js installed with Linux is probably installed in /usr/sbin/ (at least it was for me on Ubuntu 13.04). That's the old version. Since you have nvm installed and having that manage your Node.js versions, you'll want to point to ~/.nvm/v0.10.11/bin/node.
You already got a nodejs copy on your system.
The solution is to re-install or overwrite your node using /usr/local for your prefix
git clone https://github.com/joyent/node
cd node
./configure --prefix=/usr/local
make
sudo make install
Here is a similar problem:
how to delete node on linux mint 13?

Resources