[Solved] Use of create react app on Mac platform (command not found)

 

You are able to apply the following solution:

$ npm config set prefix /usr/local
$ sudo npm install -g create-react-app
$ create-react-app my-app

Use of create react app on Mac platform (command not found)

Labels (space delimited): react


Before the beginning of BB: as a new front-end Xiaobai, in order to self-study front-end bought some books to see, half a year later. If you think you have achieved the right result, you can kill all the people. However, it turns out that there are people outside, there is a day outside, and I am still the original Xiaobai… So I planned to practice again. Who would have met the pit in the first step

Gorgeous dividing line


Problem Description:

Today, in the process of learning react, the first thing is to build the environment (Environment Building Article). After browsing the above link article, I found that there are two ways to build the react environment. The first one is relatively simple, so I decided to use the first one to build the environment. But who would have thought that there was a problem:

“`shell

create-react-app hello

“`

After executing the above code, create react app: command not found is returned with an error, which means that the command does not exist

Thinking process:

At first glance, I thought it might be that it was not installed in the global environment, so I deleted it first, and then passed it

“`shell

npm install -g create-react-app

“`

I thought it was this problem, but the result is still abnormal

After consulting the data and looking at the NPM documents, I found that the NPM install – G command installed the module in the/usr/local/lib directory by default. So I went to the directory to find out whether the create react app module was successfully installed

Similar Posts: