When using 'npm' it requires me to login to github - node.js

Problem When i try to use npm in any way, ex: npm update or npm i package it immediatly gives me a github login prompt.
What i tried using npm with i, install, and even giving it git directly git://. But none worked sadly.
I am new to Node.js. So far (2 weeks), i have been updating, installing and reinstalling dependencies without a problem. Just now this issue occured.
What i was doing before the error occured was nothing special. Just programming. Last thing i used npm for was to install discord.js npm i discord.js.
Thank you in advance.

to have such a problem, it means your command is wrong. take for example you are trying to install angular cli and you omit the # symbol login will pop like so
npm install -g angular/cli // this will trigger login pop-up
npm install -g #angular/cli // will work fine
so check your command

This issue has been resolved. The problem was very simple but i couldn't figure it out at first.
So what was wrong with my issue here was that i accidently while working on my project changed a value in the "Package.json" file. This is ofcourse not intended. With that, my whole project's 'npm' command was broken where it could't work anymore.
Thank you everyone for your time.

Related

I tried doing "npm install -g expo-cli" upon which I got a bunch of vulnerabilities. On "npm audit fix" i got the following more errors

So, I've been working in node.js and react native before in Windows 10 without any issues. But ever since I started using this new laptop, with windows 11 in it, I get these annoying errors.
Doing npm install -g npm#8.3.1 gave me the following result
so I did npm audit fix as suggested, on which I was greeted with this:
and so I did npm i --package-lock-only, again, as suggested. Which got me:
IDK what I'm doing wrong. I don't know how it'll affect me. Can someone help me understand this? Thanks!
You can see from the path in your final screenshot that npm is trying to edit your package-lock.json file in the C:\WINDOWS\System32 directory and does not have permission to do that.
You can refer to this answer on how to update your npm configuration to use a folder that you do have permissions to write to.
You have no problem executing React-native even if you do not perform the npm audit fix command
Also, you are not in the right position to do the command. The command must be executed in your project folder.

How to resolve (reading 'isServer') error in npm?

Catch this error after npm i. Version npm - 8.0.0, nodejs - 16.11.0.
npm ERR! Cannot read properties of undefined (reading 'isServer')
I had the same issue with close versions of node and npm. I was using a shared connection from my phone since I wasn't home. When I get back home and used my WiFi things got back to normal.
If you are using such kind of connection then it is probably that causes this issue.
Try to use npm with specific version
for example i was trying to use npm install -g truffle and it did not work
but this one work npm install -g truffle#5.0.5
I updated npm and that fixed it!
You can update npm like so:
npm install -g npm#latest
If running this command doesn't work then you can try installing npm packages in an Admin Environment.
Hope this helps!
The issue could be due to the network, try to change the network and retry. This solved my issue :)
I've got the same issue, then I updated npm to 8.3.0, and the problem is solved.
Copying the npmrc.5 file from:
C:\Program Files\nodejs\node_modules\npm\man\man5 to C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm seemed to work for me:
Copy-Item -Path C:\Program Files\nodejs\node_modules\npm\man\man5 -Destination C:\Users\Administrator\AppData\Roaming\npm\node_modules\npm –Passthru
Try stable Nodejs version 14.16.1 instead of 16.
Nodejs 14.16.1 Link
Update the latest version of Node.js. Then try to install npm the issue won't come.
Check out this URL https://nodejs.org/en/
and install a version recommended for most users.
I had this same issue, turning off all port forwarding on my router helped.
Whenever, I saw this problem. I restarted the computer and it working immediately.
I recommend trying this solution.
Based on what I've read on issues related, it seems like there's conflicting global packages and node versions.
Please try uninstalling both node and npm and try again.
Check out these issues for more details:
Node error Cannot read property 'resolve' of undefined
Cannot read property 'resolve' of undefined when using npm to install a package
I had the same issue and tried all the possible solutions. None of them worked.
And finally, when I restarted my PC, it worked like a charm :).
It happened to me because of the node.js version and an npm update.
Uninstall nodejs
Delete folder C:\Users\Administrator\AppData\Roaming\npm
Install nodejs (v17.x)
In your project folder:
npm install -g npm#8.3.2
npm i --package-lock-only
npm audit fix --force
It worked for me. I hope it helps you :)
When I had this problem, I was trying to deploy my NodeJs server in Heroku. The problem was I forgot to load the enviroment variables manually, so it was related to the connection to the DB, that was failing.
It happened also locally for the same reason and it was still related to the failing connection to the DB.
I kept running into this problem in different scenarios. I found that because I had used a VPN during my computer session, but not during the time I ran 'npm install', it was throwing this error. I simply reinstalled and restarted and did not enable my VPN during that session. Although, you may not have to completely reinstall-- only restart you PC without using a VPN after restart-- I do not know as I have not tried.
(Specifically I was using Express VPN)
Update: I ran into the problem again immediately after a fresh install and restart. Again I restarted my computer (without a fresh install as I had just reinstalled it.) This seemed to work for the moment. Will update with any permanent fixes I come across.

name can only contain URL-friendly characters

I was trying to install package.json with npm init to install bootstrap in my folder but i am getting the error.
npm install bootstrap#4.0.0-alpha.6 --save
I am new to this i can't exactly figure what i am doing wrong.
I was following a tutorial whose link i'll attach along with screenshot of my console.
this the tutorial link
npm init is actually creating the package.json file and setting the characteristics of the project(It has no relation with bootstrap). So, in the field package name, you have to enter the name of your project (you have now entered the npm install bootstrap command) or you can just press enter if the name displayed in bracket is enough. Complete the npm init processs by setting all characteristics of project.
As next step, you can do npm install bootstrap#4.0.0-alpha.6 --save. It'll work
Deleting the lock-file and running npm i again solved the issue for me.
i was getting the same problem but i changed package-name
first name was like
My Folder Name
i changed it to
my-folder-name
no spaces & no Capital words
it solved the problem for me
Happy coding
Just hit enter and cycle through all the options. You don't type in the npm install until after you have finished init.
Not only DELETE package-lock.json in main folder but also find (whit this command find node_modules/ -iname *-lock*) and delete all '-lock' files in node_modules then run npm install again.
Make sure you are typing in the right place, npm init and then hit enter/return a few times until you are at a prompt starting with C:\Users if you are in Windows.
I also encountered the same problem when installing sass, because I watched some tutorials on YT where they instructed to use Live Sass Compiler, so I had to change some settings for saving the file. Then I uninstalled it, go through the traditional process of
npm init
npm install node-sass --save-dev
npm run compile:sass
and .....BAMMMM!!!! It worked
Press a few enter that will help you get out of npm init. then type the npm install comment. This worked for me.
I was also facing the same issue while installing the json-server ...but got resolved actually the problem is not with the folder name....so, there is two way to sort this problem one by ---- after npm init press 5-8 times enter or u can directly use (npm init -y) both will work fine
Happy coding

can't update npm (missing access)

Breaking my head to get over that error. I've tried every forum but still I can't find a proper solution. I also uninstalled and reinstall npm and still same issue.
Please save me!
npm error
and also
log
ta!
Just a wild guess:
remove .npm-modules in your home folder
remove modules from the project you are using
npm install, all should be fine
Use homebrew to install npm and nodejs. Write the command as shown below:
brew install node . Once it is successfully installed check it with node -v.
For more details you can go through this tutorial

Can install but can't run npm packages

I'm having trouble with my node.js/npm setup,
I freshly installed it via the website and it worked fine.
It told me to make sure /usr/local/bin/npm has to be in my path and when I run
echo $PATH it is in there, so it should be fine.
I can now install packages (tested with npm i webpack -save-dev) the installation works as expected, without any errors.
But when i run webpack all It is giving back is command not found has anyone experienced
something like this before?
I believe what you are looking for is a global package install.
Try using
npm i -g webpack
You can get help on install with
npm help i
Did you install node v8/npm v5?
In that case, it seems there's an open big-bug ticket on the npm repository.

Resources