I am executing following command on Windows:
npm install -g create-react-app
However I am getting following error:
npm ERR! code ETIMEDOUT npm ERR! errno ETIMEDOUT npm ERR! network request to http://registry.npmjs.org/create-react-app failed, reason: connect ETIMEDOUT 104.16.20.35: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' npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\faizanmubasher\AppData\Roaming\npm-cache_logs\2019-02-20T13_22_23_493Z-debug.log
Though I have properly set the proxy configurations:
npm config set http-proxy username:password@proxyip:port -g
npm config set proxy username:password@proxyip:port -g
npm config set https-proxy username:password@proxyip:port -g
Also tried this:
npm --proxy username:password@proxyip:port\ install -g create-react-app
I am behind corporate proxy.
Could it possibly be a problem with NPM and not the package you are trying to install? You could try this:
npm config delete proxy
Try
npx create-react-app my-app
cd my-app
npm start
Creating an App
You'll need to have Node >= 6 on your local development machine (but it's not required on the server). You can use nvm (macOS/Linux) or nvm-windows to easily switch Node versions between different projects.
To create a new app, you may choose one of the following methods: npx
npx create-react-app my-app
(npx comes with npm 5.2+ and higher, see instructions for older npm versions) npm
npm init react-app my-app
npm init is available in npm 6+ Yarn
yarn create react-app my-app
yarn create is available in Yarn 0.25+ Output
Running any of these commands will create a directory called my-app inside the current folder. Inside that directory, it will generate the initial project structure and install the transitive dependencies:
my-app ├── README.md ├── node_modules ├── package.json ├── .gitignore ├── public │ ├── favicon.ico │ ├── index.html │ └── manifest.json └── src
├── App.css
├── App.js
├── App.test.js
├── index.css
├── index.js
├── logo.svg
└── serviceWorker.js
No configuration or complicated folder structures, just the files you need to build your app. Once the installation is done, you can open your project folder:
cd my-app
npm start
You have to set your proxy in the environment variables as this image. windows env setup image
Then set your proxy using following two commands.
npm config set proxy http://proxy-server:port
npm config set https-proxy http://proxy-server:port
Sometimes you may behind the proxy, Try following methods.
You have to set your proxy in the environment variables as this image. windows env setup image
Then set your proxy using following two commands.
npm config set proxy http://proxy-server:port
npm config set https-proxy http://proxy-server:port
I tried to implement all solutions and suggested commands for npm and yarn but it's not resolved.
When I disable my VPN and try to "yarn install, " it will work fine.
If you have a VPN then try to once it disables and executes the "yarn install" command.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.