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

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

Related

my npm commands aren't working, npm is bugging?

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.

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 not working properly on windows 10

I have node.js installed via nvm, i have several versions and for some reason npm doesn't work on any of them. The versions are 4.5.0, 5.8.0 and 6.5.0 with their corresponding npm versions which i can't get because when i type npm -v
$ npm -v
[TypeError: Cannot read property 'readFileSync' of undefined]
And if i try to npm install on any project i get something similar to this (varies a little bit from project to project)
$ npm install
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.5.0
npm ERR! npm vTypeError: Cannot read property 'readFileSync' of undefined
npm ERR! Invalid Version: TypeError: Cannot read property 'readFileSync' of undefined
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:\repos\bakeIn\npm-debug.log
I've tried uninstalling nvm and reinstalling it, also removing it completely and then getting a fresh install of node and npm (not via nvm) from their website, but i get the same result. I rebooted my machine just in case but no luck.
I haven't been able to find something helpful on google or here, or maybe I'm missing something.
In any case its like the fs module is not available to npm when it runs, it was working correctly a couple of days ago.
Thanks in advance for any help :)
In this particular case, doing a full scan for rootkits, spywares, virus, etc with different software's and cleaning what was found solved the issue. Not sure specifically what caused it but it was due to a program of that nature.

NPM is not able to install

NPM is throwing errors when i try to install any app. The errors are as below -
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "ember-cli"
npm ERR! node v4.0.0
npm ERR! npm v2.14.2
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package grunt-contrib-clean#0.6.0 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer grunt-contrib#0.11.0 wants grunt-contrib-clean#~0.5.0
Any help will be highly appreciated.
Thanks,
Shaz
It sounds like you may have gotten yourself into the situation described in this issue. And, that is that an invalid module was linked with the npm link command.
After reading through there, the solution that I would try is one of the ones provided by Github user, sam-github. And, that solution is to uninstall everything that you have globally installed with npm and then try to only reinstall what is necessary.
To discover what is installed globally by npm, you can use this command:
npm ls -g
And then, to uninstall a module that is installed globally use this command: npm uninstall <module-name> -g
On the other hand, if you have never used the npm link command, then this may not solve your problem.
One of the reason for getting this error is your node version is not a stable one, try using a stable node version,
Use NVM to install multiple versions of node and switch between them and test your app.

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.

Resources