reactjs - ReactJs 错误:npm start 不工作,我还绑定了“npm cache clean --force”。我被困在我的项目中间
问题描述
这是错误:
my-app@0.1.0 start /home/gaurav/Desktop/Django + React/Saurav Hardware/saurav_hardware/my-app react-scripts start
sh: 1: react-scripts: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! my-app@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the my-app@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /home/gaurav/.npm/_logs/2020-05-20T20_38_00_671Z-`enter code here`debug.log
[// This is my package.json]
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-icons": "^3.10.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
每次我尝试启动 npm 时都会发生这种情况。它昨天工作正常,但完全停止了。我该怎么办?这个 package.json 文件中缺少什么?我也无法安装节点模块......!
解决方案
您尚未安装所有模块。运行npm install
以安装中指定的模块package.json
,然后npm start
应该可以工作。注意从react-scripts
没有找到的错误消息中,这是您未安装软件包的线索
推荐阅读
- python - 如何与 discord.py 中的附加图像进行交互
- javascript - 如何将参数从javascript传递给Ajax函数
- javascript - 突出显示的输入文本不会在按键时更新
- python - Python,macOS - 如何创建文件的查找器别名?
- css - 更改输入焦点上的边框
- google-chrome - 仅 Chrome 上的 SVG 平铺间隙
- batch-file - 如何使用 WinSCP 连续上传文件
- git - 结帐分支不会还原我的更改
- opencv - 构建 OpenCV 4 需要 CC 5.3 或更高版本 - RTX 2080TI
- swift - 如何获取firebase键值