Home>Article>Web Front-end> What should I do if an error occurs when installing react scaffolding?

What should I do if an error occurs when installing react scaffolding?

藏色散人
藏色散人 Original
2021-01-28 10:03:38 2735browse

The solution to the error when installing react scaffolding: first import the package you want to import; then clear the cache through "npm cache clean --force"; then upgrade npm; and finally install the Taobao image.

What should I do if an error occurs when installing react scaffolding?

The operating environment of this tutorial: windows7 system, react17.0.1 version, DELL G3 computer.

Recommendation:react video tutorial

An error occurred when installing react scaffolding, and the solution to the error

When there is already an error in the computer When installing the React scaffolding in the node environment, that is:

$ cnpm install -g create-react-app $ create-react-app my-app $ cd my-app/ $ npm start

When proceeding to the second step, the error in the figure below appears:

What should I do if an error occurs when installing react scaffolding?

Error message

Then it may be that the installation is not the latest. I searched it through Baidu and tried it, and found that it was successful. The terminal command is as follows:

(1) Import the package you want to import:

npm init -y

(2) Clear the cache:

npm cache clean --force

(3) Upgrade npm:

npm i -g npm

(4) Install Taobao image:

npm config set registry " https://registry.npm.taobao.org "

(5) Uninstall Taobao image:

npm config set disturl https://npm.taobao.org/dist

Among them (4) (5) are not necessary, they are just added for your convenience when related errors occur. of! If after adding the above, you proceed to the second step at the top to create the scaffolding, there should be no problem. As shown in the picture below

What should I do if an error occurs when installing react scaffolding?

#In fact, during the development process, you will encounter many, many problems, and friends in the same field may not be able to help you. At this time, you need us Solve the problem by yourself. Now that the Internet is so developed, if domestic development colleagues cannot solve it, you can also find bloggers to solve it together with more powerful people. In short, it’s a good thing that the problem is solved!

The above is the detailed content of What should I do if an error occurs when installing react scaffolding?. 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