我是React.js的新手。我遵循了https://github.com/facebook/create-react-app
中的教程。在运行npm init react-app my-app
时工作正常。但是运行npm start
时出现错误。
我尝试过https://stackoverflow.com/questions/39959900/npm-start-error-with-create-react-app
。那对我不起作用。我还尝试将项目文件夹移动到上层目录,但仍然无法正常工作.....
有人可以修复它吗?
添加:package.json
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-scripts": "2.0.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
]
}
答案 0 :(得分:0)
尝试npm install -g
更新npm
然后rm -rf node_modules
删除现有模块
最后npm install
安装新的项目依赖项