Getting errors with npm when installing nativescript - node.js

i am trying to install nativescript, i am new to it so i'll appreciate any help..
first , i installed it correctly but after that i saw a page on nativescript site for advanced installation, so i played around with it .. now i cannot run the command tns and cannot uninstall, can`t install..
here is the errors i get:
note: I also updated my nodejs to the newest version , but couldnt update npm , when i tried to run: npm install npm -g i got errors like here:
i also tried rebooting the pc but didn`t help.
i uninstalled node, npm then installed them again .. now i get this error :
ERR! network getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
ERR! network This is most likely not a problem with npm itself
ERR! network and is related to network connectivity.
ERR! network In most cases you are behind a proxy or have bad network settings.
ERR! network
ERR! network If you are behind a proxy, please make sure that the
ERR! network 'proxy' config is set properly. See: 'npm help config'
ERR! Please include the following file with any support request:
ERR! C:\Users\Home\npm-debug.log

It was a connection problem.
I remember thatI played with proxy configuration by mistake like this :
npm config set proxy http://localhost:8080/
npm config set https-proxy http://localhost:8080/
npm config set strict-ssl false
which made npm client attempts to hit localhost:8080 to pull the module rather than the correct internet endpoint.
so after couple of days of frustration i visited this link
https://docs.npmjs.com/cli/config
then run
npm config edit
which opened a file inside that file i removed those three lines i added above , then everything worked fine.

Related

Linux terminal, npm install ETIMEDOUT

I installed nodeJs and npm using nvm, that went perfectly, then I notice that a newer version of npm was available so i try
npm install -g npm#latest
But then it just stays as like that, it's like it does not start never, so I try another command and this happens
npm install -g n
Same thing, noting happens.
Trying and trying I manage to get the following error:
/home/jonathan/.nvm/versions/node/v18.12.1/bin/npx --yes --package #angular/cli ng new untitled --defaults
npm ERR! code ETIMEDOUT
npm ERR! syscall connect
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/#angular%2fcli failed, reason: connect ETIMEDOUT 2606:4700::6810:1123:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/jonathan/.npm/_logs/2022-12-28T05_07_38_682Z-debug-0.log
Done
So searching on the internet I found the url npm uses to attempt the installs the following:
registry.npmjs.org <
I tried then:
ping registry.npmjs.org
Same as above, it does nothing, it suppose to show some info every few seconds but nothing happens so y put the url in a browser and it works
{"db_name":"registry","engine":"couch_bt_engine","doc_count":3313520,"doc_del_count":332,"update_seq":31421891,"purge_seq":0,"compact_running":false,"sizes":{"active":69891815727,"external":214417993712,"file":70327402736},"disk_size":70327402736,"data_size":69891815727,"other":{"data_size":214417993712},"instance_start_time":"1672130582611333","disk_format_version":7,"committed_update_seq":31421891,"compacted_seq":31421548,"uuid":"3a4ad341a4111dd254daa731f37b37ae"}
That's what it shows.
So. I don't know what it's going on, I'm not using any proxy or firewall. Need some help here.
Update... I try using wifi not wired connection and it works, so the problem appears to be wired connection
Solution remains on network configuration, as Robert says its not related to programming so I'm marking this as answer. Thank any who try to help

What is wrong with my proxy, it does not work?

I don’t know what happened, since the Internet works for me. But I don’t copy git repositories and do not go to github
git bash
Rahat#Rahat-PC MINGW32 /c/users/rahat/downloads
$ git clone https://github.com/RahatMelsov/django-blog-app.git
Cloning into 'django-blog-app'...
fatal: unable to access 'https://github.com/RahatMelsov/django-blog-app.git/': Could not resolve host: github.com
Rahat#Rahat-PC MINGW32 /c/users/rahat/downloads
And when I want to install some kind of module from the NPM using the node.js, it produces such an error:
cmd
C:\Users\Rahat>npm install --save react react-dom
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/react failed, reason: get
addrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:443
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settin
gs.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Rahat\AppData\Roaming\npm-cache\_logs\2019-09-27T20_29_06_
174Z-debug.log
I think this is because of my proxy, as everywhere this "word" appears. Maybe something wrong with wi-fi?
enter image description here
since the Internet works for me
No it doesn't
But I don’t copy git repositories
As the error message from git explains the problem is not with git but your internet connectivity from your MING subsystem.
If you didn't understand what git was telling you, npm tells you the same thing in different words.
If npm is running natively in MS-Windows rather than under MING, then nothing on the machine can to talk to the internet.
Maybe something wrong with wi-fi?
I thought you said the internet was working for you?
create a .npmrc file if not available and do the proxy setting .
case 1 : your personal or office system where proxy not required.
registry=http://registry.npmjs.org/
case 2 : Office system and proxy required.
registry=link from whihc node packages can be downloaded , say Artifactory.
https_proxy=http://userId:password#proxyIP:Port
https_proxy=http://userId:password#proxyIP:Port

Is there a way to solve ECONNRESET error when using npm? I need to restart the machine to fix it

After using the computer for a while I cant use npm install anymore. If I restart the computer then all gets back to working.
I am using macOS Mojave 10.14.3 with node v11.12.0 and npm 6.9.0.
Tried the solutions here: npm not working - "read ECONNRESET" but no success
npm i faker
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network request to https://registry.npmjs.org/faker failed, reason: read ECONNRESET
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/flaviomelo/.npm/_logs/2019-03-28T12_25_35_242Z-debug.log
It is always possible that for a few minutes, NPM was down - so try again now just in case.
But in general, I would start by trying to find where the problem lies.
Try this:
curl https://registry.npmjs.org/faker
That should produce pages and pages of JSON. If it doesn't, then it's possible that your terminal - for whatever reason - cannot access the internet. Comments below this answer have further steps you can try in debugging this.
If it does produce lots of JSON, then there is a problem in your version of NPM / node. As these seem to be the latest, try downgrading each to see if it's a new bug.
you can try these solutions
Solution 1:
MAC + LINUX
run this command with sudo
sudo npm install -g yo
Windows
run cmd as administrator and then run this command again
Solution 2:
run this command and then try
npm config set registry http://registry.npmjs.org/

Npm throw an error after update to nodejs 8

After I update my nodejs to the latest version I always get error when trying to run npm install to install packages:
npm WARN registry Using stale data from http://registry.npmjs.org/ because the host is inaccessible -- are you offline?
npm WARN registry Using stale package data from http://registry.npmjs.org/ due to a request error during revalidation.
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.npmjs.org/escope failed, reason: getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:80
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
I don't have any issues with my internet connection and I disable the route to https: https://registry.npmjs.org and replace it with http - the first install worked and right after start not working again.
node version 8.2.1
npm version 5.3.0
Thanks for any help.
If it's helps to anyone: The only solution that works for me is to ping registry to find the IP. and the fact I have got the IP means I am not blocked
ping registry.npmjs.org
64 bytes from registry.npmjs.org (151.101.60.162): icmp_seq=1 ttl=52 time=87.3 ms
Set the IP to this host on my hosts file (Im in centos /etc/hosts/):
151.101.60.162 registry.npmjs.org
I am almost sure it's some glitch in NPM
You may want to check your NPM proxy settings and perhaps remove it.
npm config get proxy
npm config rm proxy
npm config rm https-proxy
One might expect a fresh install of NodeJS+NPM would not have a proxy configured. Strangely enough, mine did come with a proxy defined, pointing to an IP and port 3128. Removing the proxy did the trick.
Set the proxy as written below in your command prompt.
npm config set proxy http://1X.XX.X.40:80
It solved the issue.
I try the first solution, ping registry.npmjs.org and add it to host file , not work, and I try the second way :
npm config get proxy
npm config rm proxy
npm config rm https-proxy
And that work for me.
With "npm config get proxy" i had a value with port 8080 now it's null.
I don't know where that value comme from.

Can't install node package even though I'm not using a proxy

I'm (very) new to nodejs and raspberry pi.
I'm trying to install the onoff package for a test project, following this tutorial.
Everything works fine and I've set up a new node project using npm init.
Installing onoff (npm install onoff) however fails.
It says:
npm ERR! network getaddrinfo ENOTFOUND npm ERR! network This is most
likely not a problem with npm itself npm ERR! network and is related
to network connectivity. npm ERR! network In most cases you are behind
a proxy or have bad network settings. npm ERR! network npm ERR!
network If you are behind a proxy, please make sure that the npm ERR!
network 'proxy' config is set properly. See: 'npm help config'
I've checked using npm config get proxy, this returns null so I don't think this is a proxy issue.
Anyone who can help me with this?
UPDATE:
ping 74.125.224.72returns "network is unreachable"

Resources