我在Intellij IDE中从事React项目。但是,当我尝试使用npm start启动它时,我的项目失败了。错误代码告诉我,关键点是 package.json 中启动脚本的开始。
我已经在这里尝试了最常给出的建议:重新安装node.js,node_modules。但这对我不起作用。
已经感谢您解决我的问题。
这是终端中的错误代码。
VXN5155:dhbw-engineering ThomasA$ npm start
> dhbw-engineering@0.1.0 start /Users/ThomasA/Desktop/Uni/3semester/Sw-:Webengineering/ProjektPraxisSwEngineering/dhbw-engineering
> react-scripts start
sh: react-scripts: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! dhbw-engineering@0.1.0 start: `react-scripts start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the dhbw-engineering@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/ThomasA/.npm/_logs/2020-09-17T08_03_23_911Z-debug.log
编辑:以下是我的 package.json 的scripts
部分中定义的脚本:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
答案 0 :(得分:0)
运行chmod +x node_modules/.bin/react-scripts
。
然后运行npm start
。它应该可以工作