我使用create-react-app生成了一个应用程序。
当我运行yarn start或者npm start时,我遇到了以下错误:
create-react-app myapp
当我运行yarn start或者npm start时,我遇到了以下错误:
当我运行npm ls react时:react-scripts start
sh: react-scripts: command not found npm ERR! file sh npm ERR! code ELIFECYCLE npm ERR! errno ENOENT npm ERR! syscall spawn npm ERR! myapp@0.1.0 start:
react-scripts start
npm ERR! spawn ENOENT npm ERR! npm ERR! Failed at the myapp@0.1.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
myapp@0.1.0 /Users/johnno/foosball
└── react@16.2.0
react-scripts目前已存在。
这是我的package.json文件:
{
"name": "myapp",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-redux": "^5.0.6",
"react-router": "^4.2.0",
"react-scripts": "1.0.17",
"redux": "^3.7.2",
"yarn": "^1.3.2"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
我尝试了这个建议,但仍然无济于事。如何解决这个问题?
rm -rf node_modules
命令删除节点模块,然后再次运行yarn。这应该可以解决问题。 - sudo bangbang