1. npm reports an error:
Looking at a project today, an error was reported when executing npm install to install dependencies:
84 error code ENOTFOUND 85 error errno ENOTFOUND 86 error network request to https://npm.***.com/@umijs%2fpreset-react failed, reason: getaddrinfo ENOTFOUND npm.***.com npm.***.com:443 87 error network This is a problem related to network connectivity. 87 error network In most cases you are behind a proxy or have bad network settings. 87 error network 87 error network If you are behind a proxy, please make sure that the 87 error network 'proxy' config is set properly. See: 'npm help config'
ENOTFOUND npm ERR! network request to https://npm.zhonganonline.com/@umijs%2fpreset-react failed
It means that the registration address of this mirror cannot be found.
Why is there such a situation? Aren’t all npm installation mirror addresses downloaded from npm? So look at the project structure and found the .npmrc file
2. The role of the .npmrc file
There may be a .npmrc file in the root directory of some projects. When you click to open it, there is only one sentence: registry= http://registry.npm.xxxx.com
Is the npm warehouse mirror address
In npm i, if there is this file in the project root directory, node_modules will be automatically installed from this mirror address, and there is no need to manually set the mirror address.
So the problem is that there is a problem with the mirror address in the .npmrc file, just delete this file.
3. npm configuration and .npmrc file
(1) npm cli provides the npm config command for npm related configuration, through npm config ls -l you can view all the configurations of npm, including the default configuration.
(2) npm config set to modify the configuration items, after using the command configuration, all the comments in the configuration file will be deleted
(3) Some common configurations:
proxy, https-proxy: Specify npm to use a proxy
registry specifies the source of the npm download and installation package. Default: https://registry.npmjs.org/
npm config set prefix $dir
- NPM install -g create-react-app [How to Solve]
- Flutter upgrade upgrade SDK SSL_ERROR_Syscall error [How to Solve]
- No repositories directory found inside registry_ DATA_ DIR
- Git Push Error: Proxy CONNECT aborted [How to Solve]
- [Solved] Springcloud config Error: Error occured cloning to base directory.
- if a proxy or similar is necessary `net.git-fetch-with-cli`, Rust Complete `Couldn‘t resolve host name (Coul
- [Solved] NPM Install Error: EPERM: operation not permitted, mkdir xxx
- [Solved] error [email protected]: The engine “node” is incompatible with this module.
- [Solved] Fabric 2.x: error starting container: API error (404): network_test not found
- [Solved] Connection error with cocoapods. Proxy CONNECT aborted
- Git push Failed to connect to localhost port 1080 [How to Solve]
- Vue Error: command failed: npm install –loglevel error –registry=https://registry.npm.taobao.org
- How to Solve Error: libproxychains4.So error
- [Solved] Nuxt startup error: error: getaddrinfo enotfound 0
- Some problems encountered in the initial construction of Ant Design Pro project, such as cross Env, webpack and so on
- [Solved] Error from server (InternalError): an error on the server (““) has prevented the request from suc
- [Solved] NPM Error: FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed
- Git Error: failed: The TLS connection was non-properly terminated
- [Solved] ElasticSearch startup error: bootstrap checks failed
- Vue-element-admin Use npm install Error: npm ERR! Error while executing: