'react-scripts' 不被识别为内部或外部命令 [英] 'react-scripts' is not recognized as an internal or external command

查看:98
本文介绍了'react-scripts' 不被识别为内部或外部命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 maven 项目,其中包含克隆为 git 子模块的 JavaScript 项目.所以目录结构看起来像 mavenapp/src/main/javascript/[npm project files]

I've got a maven project, within which is JavaScript project cloned as a git sub-module. So the directory structure looks like mavenapp/src/main/javascript/[npm project files]

在我的 package.json 中,测试如下所示:

Inside my package.json, the test looks like this:

"test": "react-scripts test --env=jsdom",

但是当我尝试运行 npm test 时,它说

but when I try to run npm test, it says

'react-scripts' 不被识别为内部或外部命令,

'react-scripts' is not recognized as an internal or external command,

有趣的是,当我独立克隆 javascript 项目时,我没有收到此错误.我试过重新运行 npm install.

Interestingly, when I clone the javascript project independently I don't get this error. I've tried re-running npm install.

NPM 版本:5.5.1
Node.js 版本:9.3.0

NPM version: 5.5.1
Node.js version: 9.3.0

推荐答案

node_modules/ 目录中缺少 react-scripts 文件是一个错误安装.

It is an error about react-scripts file missing in your node_modules/ directory at the time of installation.

package.json 中检查您的 react-script 依赖项是否可用.

Check your react-script dependency is avaliable or not in package.json.

如果不可用,则通过以下方式手动添加:

If not available then add it manually via:

npm install react-scripts --save

这篇关于'react-scripts' 不被识别为内部或外部命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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