sh:react-scripts:运行 npm start 后找不到命令 [英] sh: react-scripts: command not found after running npm start

查看:161
本文介绍了sh:react-scripts:运行 npm start 后找不到命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将一个 React 应用程序克隆到我的系统上并运行以下命令

I cloned a react application onto my system and ran following commands

npm install -g create-react-app
npm install --save react react-dom

在那之后我跑了

npm start 

但是它抛出了上述错误,它在我将它推送到 github 的其他系统上运行良好.但是无论是windows还是mac,克隆后都不能在其他系统上运行.

But it threw the above mentioned error, It is working fine on my other system from which i pushed it on github. But it is not working on any other system after cloning whether windows or mac.

推荐答案

检查 node_modules 目录是否存在.在一个新的克隆之后,很可能没有node_modules(因为这些是.gitignored).

Check if node_modules directory exists. After a fresh clone, there will very likely be no node_modules (since these are .gitignore'd).

运行 npm install(或 yarn)以确保下载所有 deps.

run npm install (or yarn) to ensure all deps are downloaded.

如果node_modules存在,用rm -rf node_modules删除它,然后运行npm install(或yarn).

If node_modules exists, remove it with rm -rf node_modules and then run npm install (or yarn).

这篇关于sh:react-scripts:运行 npm start 后找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆