0

I'm not able to install any npm package through my local internet. But when I switch to the mobile internet it works perfectly. How can I fix this?

First of all , Here is the output of my npm config :

cli configs
long = true
metrics-registry = "https://registry.npmjs.org/"  
scope = ""
user-agent = "npm/6.14.8 node/v12.18.4 win32 x64" 

; userconfig C:\Users\iblue\.npmrc
registry = "https://registry.npmjs.org/"

; builtin config undefined
prefix = "C:\\Users\\iblue\\AppData\\Roaming\\npm"

; default values
access = null
allow-same-version = false
also = null
always-auth = false
audit = true
audit-level = "low"
auth-type = "legacy"
before = null
bin-links = true
browser = null
ca = null
cache = "C:\\Users\\iblue\\AppData\\Roaming\\npm-cache"
cache-lock-retries = 10
cache-lock-stale = 60000
cache-lock-wait = 10000
cache-max = null
cache-min = 10
cafile = undefined
cert = null
cidr = null
color = true
commit-hooks = true
depth = null
description = true
dev = false
dry-run = false
editor = "notepad.exe"
engine-strict = false
fetch-retries = 2
fetch-retry-factor = 10
fetch-retry-maxtimeout = 60000
fetch-retry-mintimeout = 10000
force = false
format-package-lock = true
fund = true
git = "git"
git-tag-version = true
global = false
global-style = false
globalconfig = "C:\\Users\\iblue\\AppData\\Roaming\\npm\\etc\\npmrc"
globalignorefile = "C:\\Users\\iblue\\AppData\\Roaming\\npm\\etc\\npmignore"      
group = 0
ham-it-up = false
heading = "npm"
https-proxy = null
if-present = false
ignore-prepublish = false
ignore-scripts = false
init-author-email = ""
init-author-name = ""
init-author-url = ""
init-license = "ISC"
init-module = "C:\\Users\\iblue\\.npm-init.js"
init-version = "1.0.0"
json = false
key = null
legacy-bundling = false
link = false
local-address = undefined
loglevel = "notice"
logs-max = 10
; long = false (overridden)
maxsockets = 50
message = "%s"
; metrics-registry = null (overridden)
node-options = null
node-version = "12.18.4"
noproxy = null
offline = false
onload-script = null
only = null
optional = true
otp = null
package-lock = true
package-lock-only = false
parseable = false
prefer-offline = false
prefer-online = false
; prefix = "C:\\Program Files\\nodejs" (overridden)
preid = ""
production = false
progress = true
proxy = null
read-only = false
rebuild-bundle = true
registry = "https://registry.npmjs.org/"
rollback = true
save = true
save-bundle = false
save-dev = false
save-exact = false
save-optional = false
save-prefix = "^"
save-prod = false
scope = ""
script-shell = null
scripts-prepend-node-path = "warn-only"
searchexclude = null
searchlimit = 20
searchopts = ""
searchstaleness = 900
send-metrics = false
shell = "C:\\Windows\\system32\\cmd.exe"
shrinkwrap = true
sign-git-commit = false
sign-git-tag = false
sso-poll-frequency = 500
sso-type = "oauth"
strict-ssl = true
tag = "latest"
tag-version-prefix = "v"
timing = false
tmp = "C:\\Users\\iblue\\AppData\\Local\\Temp"
umask = 0
unicode = false
unsafe-perm = true
update-notifier = true
usage = false
user = 0
; user-agent = "npm/{npm-version} node/{node-version} {platform} {arch} {ci}" (overridden)
userconfig = "C:\\Users\\iblue\\.npmrc"
version = false
versions = false
viewer = "browser"


Here what I tried and what I got with using -verbose flag :

stucks at here, no progress

npm info it worked if it ends with ok
npm verb cli [
npm verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm verb cli   'C:\\Users\\iblue\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli   'i',
npm verb cli   'fs-extra',
npm verb cli   '-verbose'
npm verb cli ]
npm info using npm@6.14.8
npm info using node@v12.18.4
npm verb npm-session d3224614775b0bbf
[..................] / rollbackFailedOptional: verb npm-session d3224614775b0bbf

I tried to clean the cache and I got two more steps but stuck at here

npm info using npm@6.14.8
npm info using node@v12.18.4
npm verb npm-session 8b89e4fdb645fa26
npm http fetch GET 200 https://registry.npmjs.org/fs-extra 547ms
npm http fetch GET 200 https://registry.npmjs.org/fs-extra/-/fs-extra-9.0.1.tgz 119ms
npm timing stage:loadCurrentTree Completed in 3005ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 24ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 994ms
npm http fetch GET 200 https://registry.npmjs.org/at-least-node 124ms
npm http fetch GET 200 https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz 110ms
[..................] | fetchMetadata: http fetch GET 200 https://registry.npmjs.o

Ubeyt Demir
  • 332
  • 3
  • 10

1 Answers1

2

Note As a first thing, run npm install --verbose to see more!

Try without https:

npm config set registry http://registry.npmjs.org/ --global
npm cache clear --force
Remove package-lock.json
Remove node_modules folder
npm install --verbose 

if it doesn't work then

npm config delete proxy
npm config delete https-proxy
npm set registry https://registry.npmjs.org/
Jatin Mehrotra
  • 9,286
  • 4
  • 28
  • 67
  • Http solution worked but re-setting https didn't, what could be the reason? – Ubeyt Demir Sep 18 '20 at 04:33
  • it takes a huge amount of time to retrieve the data. may be Permissions of SSL certificates or some specific checking on it.( these are my assumptions) Red this https://stackoverflow.com/a/25777070/13126651 – Jatin Mehrotra Sep 18 '20 at 04:39