How to solve the command line prompt after installing vue globally is not an internal or external command

Graphic error message:
error

This is due to the problem of not configuring global environment variables. There are two reasons for this problem:

Use npm to install vue

  The meaning of npm global installation is to download the file to a node_global folder, this folder is generally in this path of your computer (it may be different, in short, you need to find it)
  my path here is C:\Program Files\nodejs\ node_global is the node_global folder in the installation directory of node at the beginning. If you installed vue, you can find the vue folder here (if not, you need to use the npm command to install it), as shown in the following figure:
Insert picture description here
  we remember Stay in this path and configure it in the environment variable:
Insert picture description here

Use Yarn to install vue

  The solution of yarn is the same as that of npm, except that the global directory path of yarn is different. On my computer, this path is C:\Users\baiyuhang (your user name)\AppData\Local\Yarn\Data\global , if If you can't find this path, see if you show hidden files.
  Like the above, we can write this path into the environment variable, as shown in the figure:
Insert picture description here

test

Finally, we restart the command line window, enter the command vue --version , you can see that vue can be used normally.
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43592084/article/details/109635956