Home >Web Front-end >JS Tutorial >What should I do if an error occurs when installing react scaffolding?
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.
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:
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
#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!