The pit took a long time, but in order to avoid stepping on it later, it is recorded here.

1. Problem description

In the runyarn create vuepressError: File name, directory name, or volume label syntax is incorrect

At first, I thought it was vuepress’s problem. Later, I read the article online and found that Vue and UMI also had this problem. Therefore, it should be yarn’s problem.

2, step pit process

Follow the Command prompt to go to the specified directory (mine is ‘D:\02-install\node.js\node_global\bin’) and find the file create-vuepress.cmd, which reads as follows:

@"%~dp0\C:\Users\18813\AppData\Local\Yarn\Data\global\node_modules\.bin\create-umi.cmd"   %*
Copy the code

%~dp0 = %~dp0 = %~dp0 = %~dp0 = %~dp0 = %~dp0

@"C:\Users\18813\AppData\Local\Yarn\Data\global\node_modules\.bin\create-umi.cmd"   %*
Copy the code

Save the Settings and run YARN Create vuepress. The same error message is displayed: The file name, directory name, or volume label is incorrect. CMD: %~dp0. CMD: %~dp0.

CMD, run yarn Create vuepress, install again, and then overwrite the changed file.

CMD folder (‘ D:\02-install\node.js\node_global\bin ‘for me), and then run the corresponding command.

Most of the articles here say that it has been solved, and it has been solved, but I still report “file name, directory name or volume slogan method is not correct” error, I have been working until 2 am tired…

3. Ultimate solution

The next night comes back from work to fight on, to refer to a lot of data after the article found that the original is because my computer yarn directory and install the module is not in the same hard disk partition, and to go to the step that you should solve the problem of above because yarn by default installed in the disk C (i.e., run the cached data and installation directory) on disk C.

Knowing the reason, the problem is easily solved:

First look at the directory of the yarn command:

yarn global bin
Copy the code

Check the global installation location of YARN.

yarn global dir
Copy the code

The global installation location of YARN is different from that of bin. Change the global installation location and cache location of YARN.

yarn config set global-folder "D:\02-install\yarn\global"
yarn config set cache-folder "D:\02-install\yarn\cache"
Copy the code

I put YARN in another folder instead of the node folder.

Run againyarn create vuepress, finally run successfully:At this point, my problem is finally solved, I hope my solution is helpful to you.