2

I am trying to test reactjs on my computer (mbp pro 2017) running OsX sierra 10.12.6. I have followed the Facebook tutorial:

  1. Make sure you have a recent version of Node.js installed. (done)
  2. Follow the installation instructions to create a new project. https://facebook.github.io/react/docs/installation.html#creating-a-new-application

But i have a problem on this second step !

  • I am not behind a proxy.
  • my network is ok.
  • The repository is set to registry.npmjs.org
  • i can read the url : https://registry.npmjs.org/create-react-app
  • But this domain is not found even on external DNS wsg.intra.corp.grp

I'am stuck, any help will be nice !

$ npm install -g create-react-app
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/create-react-app failed, reason: getaddrinfo ENOTFOUND wsg.intra.corp.grp wsg.intra.corp.grp:8080
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!     ~/.npm/_logs/2017-09-01T08_15_13_521Z-debug.log

And the log file :

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   '-g',
1 verbose cli   'create-react-app' ]
2 info using npm@5.3.0
3 info using node@v8.4.0
4 verbose npm-session 4811d091ad74f9ef
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 silly fetchPackageMetaData error for create-react-app@latest request to https://registry.npmjs.org/create-react-app failed, reason: getaddrinfo ENOTFOUND wsg.intra.corp.grp wsg.intra.corp.grp:8080
8 verbose type system
9 verbose stack FetchError: request to https://registry.npmjs.org/create-react-app failed, reason: getaddrinfo ENOTFOUND wsg.intra.corp.grp wsg.intra.corp.grp:8080
9 verbose stack     at ClientRequest.req.on.err (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/index.js:68:14)
9 verbose stack     at emitOne (events.js:115:13)
9 verbose stack     at ClientRequest.emit (events.js:210:7)
9 verbose stack     at onerror (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/index.js:106:9)
9 verbose stack     at callbackError (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/index.js:126:5)
9 verbose stack     at <anonymous>
9 verbose stack     at process._tickCallback (internal/process/next_tick.js:188:7)
10 verbose cwd /Users/franckfournier/PycharmProjects/projectX/react
11 verbose Darwin 16.7.0
12 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "create-react-app"
13 verbose node v8.4.0
14 verbose npm  v5.3.0
15 error code ENOTFOUND
16 error errno ENOTFOUND
17 error network request to https://registry.npmjs.org/create-react-app failed, reason: getaddrinfo ENOTFOUND wsg.intra.corp.grp wsg.intra.corp.grp:8080
18 error network This is a problem related to network connectivity.
18 error network In most cases you are behind a proxy or have bad network settings.
18 error network
18 error network If you are behind a proxy, please make sure that the
18 error network 'proxy' config is set properly.  See: 'npm help config'
19 verbose exit [ 1, true ]
franckfournier
  • 344
  • 1
  • 4
  • 12

5 Answers5

5

You seem to be behind a corporate proxy, as wsg.intra.corp.grp:8080 is mentioned in the logs.

You need to configure the proxy like shown in this guide.

Hope this helps!

tbking
  • 8,796
  • 2
  • 20
  • 33
  • I'am at home no proxy is configured ??? do you think my computer os is boken or hacked ?? Because it works correclty on an ubuntu vm running on the same machine ? – franckfournier Sep 01 '17 at 13:38
  • So the question is : who and how the proxy is configured nothing apear in osx network settings ? – franckfournier Sep 01 '17 at 14:43
  • 1
    Thanks i have understand it's npm that was configured with a proxy not my computer i am a dumb idiot, sorry and thanks for answering – franckfournier Sep 01 '17 at 14:47
4

Run below commands on your command prompt. Make sure node and npm are installed.

npm config rm proxy

npm config rm https-proxy

open this link in your browser: https://registry.npmjs.org/

Run below command to set registry.

npm config set registry https://registry.npmjs.org/

Hope its help : )

theshadowmonkey
  • 689
  • 8
  • 26
3

I solved this issue just by, go to settings>Network and Internet>Proxy and then off Automatically detect settings under Automatic proxy setup on Windows. And then the installation worked fine.

0

Following this post on Github, and adding "104.18.95.96 registry.npmjs.org" to my /etc/hosts solved my problem.

randomcat
  • 413
  • 1
  • 4
  • 16
0

If you still face issues follow these steps:

  1. Go to Settings > Network and Internet > Proxy and find out the address and port
  2. Go to command prompt or terminal depending on your machine(tip: hit Win + R and type cmd). In the command prompt type the following commands

npm config set proxy http://usernamepassword@proxy-server-url:port

npm config set https-proxy http://usernamepassword@proxy-server-url:port

Username and password really isn’t needed 9 times out of 10, the last 2 will suffice. Proxy-server-url is your address and your port is the port number. Once it’s set close command prompt and re-open it. And voila! you can now install all your packages

Source: https://medium.com/@ogbemudiatimothy/using-npm-install-behind-a-corporate-proxy-server-db150c128899