Click here to Skip to main content
15,886,026 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi

I have installed Noed JS and NPM. I have cloned the repo from git and trying to run the app in local. But I am facing below proxy issue while running app.

npm install nodemon
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.com/nodemon failed, reason: getaddrinfo ENOTFOUND 28
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 have check with proxy and it is set to below network.

```Pinging proxy.internal.domainname.com with 32 bytes of data:
Reply from <ip address="">: bytes=32 time=2ms TTL=247
Reply from <ip address="">: bytes=32 time=2ms TTL=247
Reply from <ip address="">: bytes=32 time=2ms TTL=247
Reply from <ip address="">: bytes=32 time=2ms TTL=247
Ping statistics for <ip address="">:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 2ms, Average = 2ms

I tried to set proxy to https://registry.npmjs.com/nodemon using below command.
npm config set registry "http://registry.npmjs.org/


When I run npm install after this, again I got the same error.

npm --proxy http://registry.npmjs.org/  install npm
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.npmjs.org/npm failed, reason: getaddrinfo ENOTFOUND 28
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 have tried many other workarounds from google but still facing the same proxy issue.
I am just looking to run this app in local so that I can test my code in local before deploying. Am I missing something here.

Below is my sample package.json file.

{
  "name": "abc",
  "version": "0.0.1",
  "description": "abc",
  "main": "dist/index.js",
  "engines": {
    "node": "8.0.0",
    "npm": "5.0.0"
  },
  "scripts": {
    "prestart": "npm run -s build",
    "start": "node dist/index.js",
    "dev": "nodemon src/index.js --exec \"node -r dotenv/config -r babel-register\" localdev",
    "clean": "rimraf dist && rimraf -p",
    "build": "npm run clean && mkdir -p dist && babel src -s -D -d dist",
    "test": "jest --watch",
    "lint": "esw -w src test"
  },
  "keywords": [
    "express",
    "babel",
    "es6",
    "es2015",
    "es2016",
    "es2017",
    "eslint"
  ],
  "author": "abc",
  "license": "LICENSED",
  "dependencies": {
    "babel-cli": "6.26.0",
    "babel-plugin-transform-object-rest-spread": "6.26.0",
    "babel-preset-env": "1.6.1",
    "cors": "2.8.5",
    "express": "4.16.4",
    "js-yaml": "3.12.2",
    "mssql": "5.0.0",
    "winston": "3.1.0",
    "winston-daily-rotate-file": "3.5.1"
  },
  "devDependencies": {
    "babel-eslint": "7.2.3",
    "babel-jest": "21.0.2",
    "babel-register": "6.24.1",
    "dotenv": "4.0.0",
    "eslint": "4.10.0",
    "eslint-config-airbnb-base": "12.1.0",
    "eslint-plugin-import": "2.8.0",
    "eslint-plugin-jest": "21.0.2",
    "eslint-watch": "3.1.0",
    "nodemon": "1.18.10",
    "rimraf": "2.6.3"
  },
  "babel": {
    "presets": [
      [
        "env",
        {
          "targets": {
            "node": "current"
          }
        }
      ]
    ],
    "plugins": [
      "transform-object-rest-spread"
    ]
  },
  "eslintConfig": {
    "parser": "babel-eslint",
    "plugins": [
      "import",
      "jest"
    ],
    "parserOptions": {
      "ecmaVersion": 2017,
      "sourceType": "module"
    },
    "env": {
      "node": true,
      "jest": true
    },
    "extends": [
      "eslint:recommended"
    ]
  }
}


What I have tried:

I have check with proxy and it is set to below network.

Pinging proxy.internal.domainname.com with 32 bytes of data:
Reply from <ip address="">: bytes=32 time=2ms TTL=247
Reply from <ip address="">: bytes=32 time=2ms TTL=247
Reply from <ip address="">: bytes=32 time=2ms TTL=247
Reply from <ip address="">: bytes=32 time=2ms TTL=247
Ping statistics for <ip address="">:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 2ms, Average = 2ms

I tried to set proxy to https://registry.npmjs.com/nodemon using below command.

npm config set registry "http://registry.npmjs.org/

but after this also I am facing same proxy issue.
Posted
Updated 12-Sep-21 5:05am

A proxy is a service which takes place between your machine and the external network (internet) and apply access policies based on conditions (client machine, destination address, protocol, port number, time of the day, group membership of the user, etc...).
If you have a proxy on your network, then you have to provide its internal address. 'https://registry.npmjs.com/nodemon' is not a proxy, it is the target address.
If you continue having access issues after having configured proxy's address (proxy.internal.domainname.com), then there is most likeky a policy on the proxy which prevents you from accessing this outsider content. The way to go is then to talk to your network administrator/hierarchy and try and get the proxy configured to allow such access.
 
Share this answer
 
Comments
Telstra 3-Feb-20 7:47am    
Thanks for your suggestion. I will check with network team.
I have resolved this issue with below steps :

make sure you have internet connection: ping 8.8.8.8
make sure you have DNS resolver working: ping www.google.com
make sure you can access registry.npmjs.org: ping registry.npmjs.org
make sure you can connect via https.

Run below command in npm command prompt or Visual Studio Code terminal.
npm config rm proxy
npm config rm https-proxy


Try in your browser: https://registry.npmjs.org/

Make sure you are trying to connected to:
registry.npmjs.org

and not to:
registry.npmjs.org registry.npmjs.org:443

Use below command to set registry.
npm config set registry https://registry.npmjs.org/


If you are using a proxy to access the Web, then you also have to configure npm to use it.
npm config set proxy http://username:password@proxyname:8080

npm config set https-proxy http://username:password@proxyname:8080


Points to remember here while setting above two values :
1. proxyname you need to check with your company network team. Enter that proxy URL in above two values.
2. If your password contains any special character then replace it with Encoded character. In this command you can’t provide a password with special character. Replace only special character not .(dot).
Quote:
Example: password is : Welcome@12# then it will be like Welcome%4012%23.

Then try to run your npm install command and it should work.
 
Share this answer
 
Comments
Richard MacCutchan 27-Feb-20 10:15am    
The line below "and not to" may need editing. Other than that +5 for such a comprehensive and well written solution.
Telstra 28-Feb-20 6:05am    
Thanks a lot for your words. It will help for those who are facing same issue. For me it took 15 days to resolve this. Hope this solution will save time for others.
jasterix 24-Jun-20 5:21am    
Great answer! Going through the pre-steps you laid out (ping ping 8.8.8.8, etc), I realized my terminal was oddly not connecting to the internet. Restarting my computer fixed the issue
Member 15027014 21-Dec-20 13:26pm    
thanks for this answer, i was so worried and irritated for 2 days. very very thanks
Aldair B. Vicente 16-Aug-21 15:17pm    
Hi everyone!
Someone knows which table was used to this "Encoded character" in this last step? I tried ASCII and others but without success for convert my password to this "uncoded" format used on the command to set the proxy configuration of NPM.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900