在我的
package.json
文件中,我有以下脚本块: "scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
我知道当我们输入 npm start
或 npm run start
时,它会执行位于 start
下的 scripts 块中列出的命令。
当我输入 npm start
时,它会启动我的 React 应用程序。
那么为什么当我输入 react-scripts start
时,它会显示:
bash: react-scripts: command not found
npm install -g react-scripts
命令可以将该库全局安装,以便直接运行。 - Francesc Montserrat