VSCode displays "Not recognized as the name of an operational program" when executing the yarn command.

Asked 1 years ago, Updated 1 years ago, 102 views

When I run yarn start on the Visual Studio Code terminal to start the Webpack Dev Server, the following error message appears:
What should I do?

 yarn: The term 'yarn' is not recognized as a cmdlet, function, script file, or name of an operational program.with a correct name
Make sure that you are doing it, and if the path is included, make sure it is correct, and then try again.
Location line: 1 character: 1
+ yarn start
+ ~~~~
    + CategoryInfo: ObjectNotFound: (yarn: String) [ ], CommandNotFoundException
    + Fully QualifiedErrorId—CommandNotFoundException

vscode yarn

2022-09-30 15:45

2 Answers

Which operating system is it?

'yarn' is not recognized as a cmdlet, function, script file, or name of an operational program.Correctly named

Probably Windows from the above error message.

The terminal in vscode is only starting cmd unless you have specifically adjusted the settings.
(You can change whether you want to open cmd or powershell.)
Therefore, the cause of the error message is generally similar to that of using cmd normally.
If a specific command =exe is not found, then PATH is not passing through it.

Add/Summary

The first is the command exexe in Windows.
Think of exexe as a double-click to execute the command.

"Through PATH" means adding a folder to look for commands when trying to execute a command at a CUI (commonly known as a command prompt (cmd) or powerhell).
PATH allows you to execute the command without entering the full path, including the folder path.

To add a path, add the folder path below.
Control Panel > System > Advanced System Settings > Environment Variables > System Environment Variables > Path
※ I think there are many sites that explain more politely if you use gg in PATH.

The difference between the user environment variable and the system environment variable is the difference between setting it differently for each user logged into the OS or applying it regardless of the user.

I think where the yarn command (exe) itself is depends on how you installed yarn itself.


2022-09-30 15:45

After you install Node.JS and run PATH, you can use the yarn command.

C:>where yarn
C:\opt\nodejs\yarn
C:\opt\nodejs\yarn.cmd

PSC:>yarn-v
1.22.17


2022-09-30 15:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.