简体   繁体   English

React serve -s build,“服务”一词未被识别为 cmdlet 的名称

[英]React serve -s build, The term 'serve' is not recognized as the name of a cmdlet

Hello I am trying to build my react app so I did yarn build and it created the necessary folder now I am trying to do serve -s build and it's telling me the error below您好,我正在尝试构建我的反应应用程序,所以我进行了yarn build ,它创建了必要的文件夹,现在我正在尝试进行serve -s build ,它告诉我下面的错误

错误

** I have tried to uninstall and reinstall serve by npm uninstall -g serve and npm install -g serve and I found the serve folder in C:\Users\Nairi\AppData\Roaming\npm\node_modules ** 我尝试通过npm uninstall -g servenpm install -g serve卸载并重新安装服务,我在C:\Users\Nairi\AppData\Roaming\npm\node_modules

Try npx serve -s build I don't know why but they happened to me also and this worked尝试npx serve -s build我不知道为什么,但它们也发生在我身上,这很有效

Solution1 : yarn global add serve解决方案1yarn global add serve

As the Docs says, you can install it globally yarn global add serve , then use it as you want like serve -s build正如文档所说,您可以全局安装它yarn global add serve ,然后根据需要使用它,例如serve -s build

Solution2: npx : npx serve -s build解决方案2:npxnpx serve -s build

As this article says, npx will check whether <command> or <package> exists in $PATH , or in the local project binaries( node_modules ), and if so it will execute it, and if it's not there, it will download it.正如本文所说, npx将检查$PATH或本地项目二进制文件( node_modules )中是否存在<command><package> ,如果存在,它将执行它,如果不存在,它将下载它。 You can also run packages from github您还可以从 github 运行包在此处输入图像描述

Check your admin permissions, so it can install globally with the -g flag检查您的管理员权限,以便可以使用 -g 标志全局安装

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 术语“expo”未被识别为 cmdlet 的名称 - The term 'expo' is not recognized as the name of a cmdlet “serve -s build”返回“serve: command not found” - "serve -s build" returns "serve: command not found" 当运行“serve -s build”在本地为我的 React 构建文件夹提供服务时,没有内容呈现 - When running "serve -s build" to serve my React build folder locally, no content renders 将反应构建作为烧瓶中的模板 - Serve react build as a template in flask 如何使用 docker 和 serve -s build 部署 React 应用程序 - How to deploy React app with docker and serve -s build 使用“serve -s build”来提供反应应用程序时,静态 img 不显示 - When using "serve -s build" to serve react app, static img does not show up create-react-native-app:术语“create-react-native-app”未被识别为 cmdlet、function、脚本文件或可运行程序的名称 - create-react-native-app : The term 'create-react-native-app' is not recognized as the name of a cmdlet, function, script file, or operable program create-react-app 中的问题:术语“create-react-app”未被识别为 cmdlet、function、脚本文件或可运行程序的名称 - Issue in create-react-app : The term 'create-react-app' is not recognized as the name of a cmdlet, function, script file, or operable program npx serve -s build -l 3000 不工作 - npx serve -s build -l 3000 is not working 无法在本地系统上部署反应应用程序。 无法识别发球 - Unable to deploy react app on local system. Serve is not recognized
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM