Unable to perform "sudo npm install --save firebase-admin" - node.js

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.

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.

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 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

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

Travis - Control Which Node Version is used for NPM Installs

I am attempting to install an npm package (markdown-pdf) as part of my Travis-CI build which I believe is not compatible with old versions of Node. On my local machine, I am running Node version 0.10.36, and it works here, so I added what I believe to be the accepted way of defining a specific version to the top of my .travis.yml file (although I'm not clear on that either). The MCVE version of the full file is below.
language: node_js
node_js:
- "0.10"
install:
- sudo apt-get install npm
- npm config set registry http://registry.npmjs.org/
- sudo npm install -g markdown-pdf
script:
- echo "stuff was installed."
At the top of the build log, I see the following, which seems to indicate that my change worked:
$ nvm install 0.10
######################################################################## 100.0%
Now using node v0.10.40
$ node --version
v0.10.40
$ npm --version
1.4.28
$ nvm --version
0.23.3
However, further down the log, when travis attempts to execute sudo npm install -g markdown-pdf, the log reports the following. Notice that it suggests that the package might not be compatible with the version of Node that is installed, and it claims that I'm using Node v0.6.12.
$ sudo npm install -g markdown-pdf
npm http GET http://registry.npmjs.org/markdown-pdf
npm http 200 http://registry.npmjs.org/markdown-pdf
npm ERR! Error: No compatible version found: markdown-pdf
npm ERR! No valid targets found.
npm ERR! Perhaps not compatible with your version of node?
npm ERR! at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
npm ERR! at next_ (/usr/share/npm/lib/cache.js:438:17)
npm ERR! at next (/usr/share/npm/lib/cache.js:415:44)
npm ERR! at /usr/share/npm/lib/cache.js:408:5
npm ERR! at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR! at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
npm ERR! You may report this log at:
npm ERR! <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR! reportbug --attach /home/travis/build/ahemmeter/ahemmeter.github.io/npm-debug.log npm
npm ERR!
npm ERR! System Linux 2.6.32-042stab108.3
npm ERR! command "node" "/usr/bin/npm" "install" "-g" "markdown-pdf"
npm ERR! cwd /home/travis/build/ahemmeter/ahemmeter.github.io
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message No compatible version found: markdown-pdf
npm ERR! message No valid targets found.
npm ERR! message Perhaps not compatible with your version of node?
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/travis/build/ahemmeter/ahemmeter.github.io/npm-debug.log
npm not ok
I think I've provided enough information, but you can also look at the public build logs for the project and the github repository it's building.
Have I made a mistake in declaring which version of Node to use? Do I need to (or should I) do something similar for npm, nvm, and markdown-pdf? How can I force npm-install to use the newer version of Node rather than the old one?
Note that I set the repository to download over HTTP instead of HTTPS. When I did that, the error message changed from "failed to fetch from registry: markdown-pdf" to "No compatible version found: markdown-pdf", which seemed like a step in the right direction, so I kept it; however, I mention it here in case there is a possibility that it causes a conflict.
In order to specify dependencies when using node.js, travis seems to expect a package.json file. You can also use this to specify which version of the node package you want to download.
.travis.yml
language: node_js
node_js:
- "0.10"
script:
- echo "stuff was installed."
package.json
{
"name" : "ahemmeter.github.io",
"version" : "0.0.0",
"dependencies" : {
"markdown-pdf" : "5.3.x"
}
}
Note from OP: This is the answer I found, but If someone posts an answer that does not involve using a package.json file (this is just a test suite rather than a package and I don't want to publish it as a package), I'll mark that answer as accepted.

Resources