[英]yarn eg:'live-server' is not recognized as an internal or external command
I am using yarn v1.6.0 as a dependency manager, I have installed live-server globally by using the following command: yarn global-add live-server
我使用 yarn v1.6.0作为依赖管理器,我使用以下命令全局安装了live-server :
yarn global-add live-server
But when executed it like live server
, it is giving the following error:但是当像
live server
一样执行它时,它给出了以下错误:
'live-server' is not recognized as an internal or external command, operable program or batch file.
'live-server' 不是内部或外部命令,也不是可运行的程序或批处理文件。
It is obvious my path is not configured Can some help which path should I use an environment variable?很明显我的路径没有配置可以帮助我应该使用哪个路径环境变量?
I tried to see my version of live-server but got this error,You can use我试图查看我的实时服务器版本,但出现此错误,您可以使用
npm install -g live-server
npm install -g live-server
in your npm command line在你的 npm 命令行中
All the packages you download from yarn gets stored in bin folder inside yarn directory.你从yarn下载的所有包都存储在yarn目录下的bin文件夹中。 So, you have to set the path of the bin folder of your yarn in PATH environment variable as you might have did with the bin directory of the npm .
因此,您必须在PATH环境变量中设置纱线的bin文件夹的路径,就像您对npm的bin目录所做的那样。
1). 1)。 The following path would get you to the bin folder in Windows machine then set this path to the PATH environment variable.
以下路径会将您带到Windows机器中的bin文件夹,然后将此路径设置为PATH环境变量。
C:\\Users\\Username\\AppData\\Local\\Yarn\\bin C:\\Users\\Username\\AppData\\Local\\Yarn\\bin
2). 2)。 For macOS do the following
对于 macOS,请执行以下操作
$ export PATH=$PATH:/home/user/.yarn/bin/ $ export PATH=$PATH:/home/user/.yarn/bin/
Copy the path
of the bin of the yarn.复制纱线箱的
path
。
C:\Users\USER NAME\AppData\Local\Yarn\bin
Go to the Environment variables
.转到
Environment variables
。
Select, path -> new -> paste the copied path
.选择,路径 -> 新建 -> 粘贴复制的
path
。
Reopen the cmd and type重新打开cmd并输入
live-server -v
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.