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

藏色散人
Release: 2022-12-30 11:12:52
Original
2716 people have browsed it

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
Copy after login

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
Copy after login

(2) Clear the cache:

npm cache clean --force
Copy after login

(3) Upgrade npm:

npm i -g npm
Copy after login

(4) Install Taobao image:

npm config set registry " https://registry.npm.taobao.org "
Copy after login

(5) Uninstall Taobao image:

npm config set disturl https://npm.taobao.org/dist
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!