今天,我决定创建一个React应用程序,该任务已经完成了很多次,并且在终端中运行create-react-app命令后:我导航到已安装的新项目目录中我知道我需要一些依赖,最后我运行了[[npm start,而令我惊讶的是-什么都没发生。 npm start不仅无效,而且package.json文件中的所有脚本均未执行且完全没有响应。此外,由于出现此错误,我所有React项目中的所有可执行脚本都无法执行。
上周,我在安装sqlite3时遇到了一些麻烦,并且必须进行大量维护才能在项目中使用它;也许我删除了运行脚本的npm中需要的文件?我将在下面保留对我的package.json文件的引用,尽管我根本没有对其进行太多更改。{
"name": "maps",
"version": "0.1.0",
"private": true,
"dependencies": {
"cors": "^2.8.5",
"errorhandler": "^1.5.1",
"morgan": "^1.9.1",
"node-fetch": "^2.6.0",
"react": "^16.11.0",
"react-dom": "^16.11.0",
"react-scripts": "3.2.0",
"sqlite3": "^4.1.0",
"body-parser": "^1.19.0",
"express": "^4.17.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test"
},
"proxy": "http://localhost:3001",
"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"
]
}
}
感谢您解决此问题的小知识!
1. Delete the node_modules folder from your project directory
2. run the command `npm install` in the project directory
3. run `npm start` in the project directory