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
- No repositories directory found inside registry_ DATA_ DIR
- Vue Error: command failed: npm install –loglevel error –registry=https://registry.npm.taobao.org
- Some problems encountered in the initial construction of Ant Design Pro project, such as cross Env, webpack and so on
- How to Solve Import antd Error: Module build failed
- Centos pip install uwsgi error: “fatal error: Python.h: No such file or directory”
- Start Docker Quickstart Terminal error This computer is running Hyper-V. VirtualBox won’t boot a 64bits VM when Hyper-V is activated
- NPM run dev Error Module build failed: Error: Cannot find module ‘node-sass’
- Spring boot uses configuration interface webmvcconfigurer to solve cross domain problems
- How to Solve Maven Error: Return code is: 501 , ReasonPhrase:HTTPS Required.
- Swagger-ui.html Open Error: There was an unexpected error (type=Not Found, status=404)
- Git Pull Error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errfno 10054
- When installing zookeeper, you can view the process start, but the status display error: Error contacting service. It is probably not running
- Git: “error: RPC failed; curl 18 transfer closed with outstanding read data remaining”
- Attempted import error: ‘mobx-react‘ does not contain a default export (imported as ‘observer‘).
- Flutter Xcode Module not found or LibreSSL SSL_connect: SSL_ERROR_SYSCALL
- UnknownHostException error when connecting to Mongo cluster Java
- How to Solve Error: Cannot find the declaration of element ‘beans’.
- [Solved] Executing npm install error: npm ERR! code EINTEGRITY
- [Solved] Openwrt Pptpd Start Error: validation filed