Home  >  Article  >  Web Front-end  >  Solution to the slow build of create-react-app project

Solution to the slow build of create-react-app project

亚连
亚连Original
2018-05-30 14:08:411582browse

This article mainly introduces the solution to the slow build project of create-react-app. Now I will share it with you and give you a reference.

Solution to slow create-react-app

When operating the official instance Create React App, you need to execute the command:

create-react-app my-app

to create a new React application. For some reason, when pulling various resources, it is often extremely slow and stuck at

fetchMetadata: sill mapToRegistry uri http://registry.npmjs.org/whatwg-fetch

. The solution is to change the source, although usually Use cnpm to replace npm, but it just uses new instructions. When looking for the relevant configuration of create-react-app and hoping to modify the registry, it failed. Finally, I found that the create-react-app instruction calls npm by default, so I directly changed npm's Just set the register permanently, so there will be no difference between using cnpm or npm.

npm config set registry https://registry.npm.taobao.org
-- 配置后可通过下面方式来验证是否成功
npm config get registry
-- 或npm info express

After the setting is successful, execute create-react-app my-app and you will be surprised.

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

Simple web server function example implemented by nodejs

Project created by vue-cli, with many configurations Page implementation method

Nodejs simple method of accessing and operating mysql database example

The above is the detailed content of Solution to the slow build of create-react-app project. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn